Posts tagged debian

apt cheatsheet

posted on 2017-01-23 21:31

As short as possible:

apt-cache search = search for package (old)
apt-cache show = show package information
dpkg -l = show installed packages
dpkg -L = show package contents
dpkg -S = search packages for file
apt-get install = install package (old)
apt-get remove = uninstall package, leave configuration on disk (old)
apt-get purge = uninstall package, delete configs (old)

apt search = (new)
apt install = (new)
apt remove = (new)
apt purge = (new)

debian add another loopback address

posted on 2017-01-04 15:40

Add to /etc/network/interfaces:

auto lo:1
iface lo:1 inet static
address 127.0.0.2
netmask 255.0.0.0

then

ifup lo:1

and an ip a should show you the new ip being live.

apache mod_pagespeed installation on debian 8

posted on 2016-08-29 09:36

In short for x86_64:

wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_amd64.deb
dpkg -i mod-pagespeed-stable_current_amd64.deb
service apache2 restart

nodejs debian install howto

posted on 2016-06-28 18:40

create dedicated node user

 # add user
 useradd -m -U -G sudo -s /bin/bash nodejs

 # create random password for copy-pasting
 pwgen -A0 16 1

 # set password
 passwd nodejs

install from package management and official script

# change user
su nodejs
# go to homedir
cd

# install
### you could also use for version 4, instead of v6 as we will do
##curl -sL https://deb.nodesource.com/setup_4.x | sudo bash -
curl -sL https://deb.nodesource.com/setup_6.x | sudo bash -
sudo apt-get install -y nodejs

# back to root
exit

If you just install the nodejs package without executing the script, npm, nodejs's package manager will be missing.

fix user rights

 # remove complete sudo
 deluser nodejs sudo
 # let our user handle node installl stuff
 # `visudo` for editing `/etc/sudoers`, then put in there:
 Cmnd_Alias NODE_CMDS = /usr/bin/npm
 nodejs ALL=(ALL) NOPASSWD: NODE_CMDS

debian: build newest kernel

posted on 2016-06-05 19:23

prerequisites

You should have like 50G of harddisk space available. Since I currently don't (SSD), I use an external harddisk.

Also:

apt install build-essential kernel-package libssl-dev xz-utils ncurses-dev

These are like ~1,3G of additional files on your main system, if you install without the --no-recommends flag.

get sources

Head over to kernel.org and download the source of the kernel of your choice. You should know what stable means and wether you want to use a release client or not, else get the stable kernel.

I will use the current RC release.

extract, copy current config, start compiling

tar xJvf linux-4.7-rc1.tar.xz
cd linux-4.7-rc1/

# copy currently used configuration. otherwise use `make menuconfig`.
cp /boot/config-`uname -r` .
yes "" | make oldconfig

# see how many cores you can use for compiling
# count amount of cores on top, then press 'q'
htop

# build, pass corecount with '-j' flag
make-kpkg -j4 --append-to-version "-sjas" --initrd buildpackage
# if the previous step failed, do these
## make clean
## rm -rf .config
## make menuconfig # save to .config  and exit immediatly
## then redo the previous make-kpkg

I also had a more specific error last time:

make[4]: *** No rule to make target 'debian/certs/benh@debian.org.cert.pem', needed by 'certs/x509_certificate_list'.  Stop.
Makefile:985: recipe for target 'certs' failed

Solution was to comment the CONFIG_SYSTEM_TRUSTED_KEYS line out from my .config.

debian permanent ctrl on caps in pty's and tty's

posted on 2016-05-23 00:52

To set both the pseudoterminals and the virtual consoles up to have CTRL instead of CAPSLOCK:

vim /etc/default/keyboard:

XKBOPTIONS="ctrl:nocaps"

Save and run:

dpkg-reconfigure -phigh console-setup

Debian: NIC bonding config

posted on 2015-12-02 22:14:55

Additionally to the bonding config, there is also a bridge setup, as this was for a proxmox setup.o

The needed packages:

apt-get install ifenslave bridge-utils

ifenslave is for bonding, bridge-utils for bridging.

The actual config: (replace the 10.0.0.x IP Stuff)

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# external bond
auto bond0
iface bond0 inet manual
    bond_mode 802.3ad
    bond_xmit_hash_policy layer2+3
        bond_lacp_rate fast

    slaves eth0 eth2
    bond_miimon 100
    bond_downdelay 200
    bond_updelay 200


# crosslink / internal bond
auto bond1
iface bond1 inet static
    address 192.168.100.2/24
    network 192.168.100.0
    broadcast 192.68.100.255

    slaves eth1 eth3
    bond_mode balance-rr
    bond_miimon 100
    bond_downdelay 200
    bond_updelay 200


# bridge extern
auto vmbr0
iface vmbr0 inet static
    address 10.0.0.2/24
    network 10.0.0.0
    broadcast 10.0.0.255
    gateway 10.0.0.1
    dns-nameservers 8.8.8.8

    bridge_ports bond0
    bridge_stp off
    bridge_fd 0

Linux: website migration guide

posted on 2015-06-19 19:53:32

Migrating a website can be a tedious task, if you have problems keeping several things at once inside your head. This aims to solve this problem by presenting some proper guidelines.

Here we have a standard dynamic website with a mysql backend, served through an apache httpd.

For other databases/webservers the steps may differ in particular, but essentially this is the same theory everytime.

Mailmigration will as of now not be a part of this here, since it's gonna be long enough anyway.

Read this completely prior, as alternative ways are suggested sometimes.

preparations

This part is almost the most important, actual copying is usually not that hard if you know what you are doing. It's often harder to remember everything.

Before we start, the server can serve data of three kinds which are handled all the same way.

web data, just copy the website code
database, copy the database dump file
emails, copy the mailfiles

The server is accessed via the globally available...:

dns

Basically these are the things you have to copy/adjust so things will go smooth.

preparations

open questions

Putting most of these questions plus the answers to them into a spreadsheed is not the worst idea. Maybe I will come up with a shell one-liner to create a .csv later.

Also it is helpful if you are able to do FXP (transfer files from one host directly to the other, without temporary saving the data/files locally), if you do not have SSH access.

  • server access via ssh is possible?

  • ssh works via key? or password only?

  • root account? (a lot of this guide assumes root privileges, I might have missed points there are no alternatives)

  • if not, do you have all necessary account credentials for all folders etc.?

  • DO THESE WORK?

  • if no ssh, do you have ftp credentials?

  • do the credentials actually work?

  • do you get a database dump you can transfer? (If you cannot access the server, you can't make a dump.)

  • are the folder accurately named?

  • how BIG is the webfolder? (so how long will copying take?)

  • which database management system is used? (i.e. mysql or postgres)

  • database credentials for it are?

  • what is the database the site is using actually called?

  • just how BIG is the database? (and so how long will copying take?)

  • what domains are pointing to the server?

  • are these actually active?

  • and can you change the DNS RR?

  • what are the DNS TTL times?

  • is mailing configured?

  • don't forget the DNS MX RR/RR's while at the last point

DNS: aquiring information active resource records

For finding out about the dns, if you have several virtual hosts on the same machine, try grepping them all there.

When having an apache, grep all vhost files for ServerName and ServerAlias. Here's a kind-of snippet, which will work if your apache vhost configs are in default locations and indented:

\grep -e '^\s\+Server' /etc/apache2/sites-enabled/*

This shows only active sites, check sites-available if you have to migrate sites which are currently turned off, too.

The resulting list, if sanitized, can be piped on the shell and used with something like host/nslookup/echo + dig +short, to easily check which domains are still running. Check all the records, not just the A/AAAA (quad-A is ipv4, single-A is ipv4) records, also MX and whatever is set. If the exit code is non-zero, no dns anymore and less work for you. Providing a script here would not help much, since you should know what you are doing here anyway and it would most likely not help you much.

and maybe prepare the webserver, too

In case the apache config is, lets say, 'adventurous', do apache2ctl -S (Debian/Ubuntu) or httpd -S to see which domains are hosted, and in which file these are defined. Then search there for ServerName/ServerAlias directives.

If the webserver happens to have all vhosts defined in one huge file (which ist just... very not great), remove the configuration and place them into a separated file. In Debian-based Linuces you can use a2ensite <vhost-config-filename> / a2dissite <vhost-config-filename> to enable/disable single websites easily. On Redhat-based ones you create the symlinks to the configfolder apache is configured to load manually and delete them also by hand. (This isn't any different from what a2en/dissite do.) All this only for the sites you want to migrate.

Of course, you can just comment out the information on your vhosts from the config, but just... don't.

For other webservers all this is different, of course, but you get the idea.

DNS: get the domains and the website together, information-wise

Refer to the website via its main link. (apache ServerName from above.) But make sure to note all other aliases there, too. (apache ServerAlias from above.) Since you can only migrate one site after another, this helps to keep track. Write all this down, each alias in another row. Maybe put the inactive ones into an extra column there, too. Could be that these should be prolonged again, or were incorrectly set. (I.e. it did not point to the webserver when you checked.)

Write the set TTL into the next column, along with the current date. (Usually TTL is 86400, which means 24 hours, which is exactly how long it will take until your change to 1800 seconds becomes finally active. If the TTL was longer than 86400 for whatever reason, note that into your list, too!)

DNS: lower TTL the day before the migration

After having created a list and checked which domains are currently active, set the default TTL time to 1800. (Just don't go below, 30 mins are short while you do the migration. Also the registrar might prefer you not to.)

DNS: plan b in case you have dozens of websites to migrate

If you have A LOT of websites that should go from one server to the next, try migrating and testing everything (via entries in the hosts file). Then switch the ip's of the servers with each other. That way no dns changes are needed (except if you have dead domains), because this shit can become tedious, too.

TBD / todo

Nothing more here now, until i am motivated again to write more stuff up.

sshd: show ssh logins and fails

posted on 2015-03-05 11:13:00

successes

To show all successful login attempts on a debian-based system:

cat /var/log/secure | grep 'sshd.*opened'

Same for RHEL:

cat /var/log/auth.log | grep 'sshd.*opened'

fails

Debian's:

cat /var/log/auth.log | grep 'sshd.*Invalid'

RHEL's:

cat /var/log/secure | grep 'sshd.*Invalid'

Installing emacs 25 on debian wheezy

posted on 2015-02-04 13:55:58

To install and not having to care about package dependency hell, here's a walkthrough:

  1. apt-get install -y git-core libxaw7-dev libxpm-dev libpng12-dev libtiff5-dev libgif-dev libjpeg8-dev libgtk2.0-dev libncurses5-dev autoconf automake
  2. apt-get build-dep emacs
  3. git clone --depth 1 -b master git://git.sv.gnu.org/emacs.git
  4. cd emacs
  5. ./autogen.sh
  6. ./configure --prefix=/opt/emacs25
  7. make
  8. sudo make install

Step 8 as root, so emacs will be available system-wide.

Convert .rpm's to .deb's

posted on 2014-10-30 19:53:49

To use .rpm files in debian (If god likes you, then they just may.), you have to convert them to .deb formatted files. alien is the weapon of choice.

# apt-get install alien

To convert and install:

alien <packagename>.rpm
dpkg -i <packagename_converted>.deb

To convert and install in one step:

alien -i <packagename>.rpm

By default, the version number of the .rpm files will be incremented by one. If you do not want this behaviour, you might try the -k flag.

mysql reset root password

posted on 2014-09-08 11:27:38

To reset mysql passwords, connect from the commandline to the mysql daemon.

But like this:

  1. service mysql stop
  2. mysqld_safe --skip-grant-tables --skip-networking. That way no pw checks are made, and network connections are disabled, only localhost connections are enabled. (Security!)
  3. change password: mysql -Ne "update mysql.user set password=password('this_is_the_new_password') where user='root'; flush privileges;"
  4. stop mysqld with killall -9 mysqld_safe
  5. service mysql start
  6. try the account with the new password

If it is not working, service mysql stop again, start mysqld_safe --skip-grant-tables --skip-networking and fix the password, as you likely had a copy-paste or typing in there the last time.

Tomcat memory settings on Debian

posted on 2014-08-27 17:57:37

To double all the base tomcat memory limits, use this:

/etc/default/tomcat7:

JAVA_OPTS="-Djava.awt.headless=true -XX:+UseConcMarkSweepGC -Xms512m -Xmx1024m -XX:MaxPermSize=256m"

This edits the startup settings of tomcat. The parts in question are these:

# set the minimum heap size
-Xms512m
# set the maximum heap size
-Xmx1024m
# set the permgen space size
-XX:MaxPermSize=256m

Try these if your tomcat has hickups.

SSH debugging

posted on 2014-08-26 16:40:50

When debugging SSH connections, or rather their connection establishment mishaps, check the logs:

Debian:

/var/log/auth.log

RedHat:

/var/log/secure

Usually this does suffice. If not, increase the Log Level in /etc/ssh/sshd_config.

Change tomcat's used java version

posted on 2014-08-12 10:20:19

To change the java version used, on a debian install, which is used by tomcat, change /etc/default/tomcat7.

There you have to change the JAVA_HOME setting accordingly.

Exporting JAVA_HOME by hand is no use, and changing the init script in /etc/init.d/tomcat7 is not just ugly and bad style, but michgt also be overwritten by future updates.

Create password and copy it into clipboard

posted on 2014-08-07 09:51:29

To create a password and put it into you clipboard immediatly, use this line in your window manager's global shortcuts:

echo `\pwgen -cn 18 -1` | cut -d' ' -f1 | tr -d "\n" | xclip   

Run wireshark as non-root user

posted on 2014-08-05 10:23:00

To run wireshark as a non-root user, do this (as root, or use sudo):

apt-get install wireshark   
dpkg-reconfigure wireshark-common
usermod -a -G wireshark USER
# logout and login for new environment, for testing do:
groups USER  ## should lack group wireshark
su USER
groups USER  ## should now have group wireshark and thus work
wireshark

MySQL Debian root password reset

posted on 2014-08-04 16:24:52

If you have lost your mysql root password, and you happen to be on a debian system, you have luck:

[sjas@test ~]# cat /etc/mysql/debian.cnf 
# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host     = localhost
user     = debian-sys-maint
password = r51fkvVRogY4i5oj
socket   = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host     = localhost
user     = debian-sys-maint
password = R51fkvVRogY4i5oj
socket   = /var/run/mysqld/mysqld.sock
basedir  = /usr

On debian, a system user with the same rights as mysql's root is created upon install. This one is used for mysql updates, for example.

So you can login into mysql, using the password from above:

$ sudo mysql -u debian-sys-maint -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 37
Server version: 5.5.38-0+wheezy1 (Debian)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> update mysql.user set Password=PASSWORD('my-new-and-secret-password') where user='root'; flush privileges; exit;
Query OK, 4 rows affected (0.01 sec)
Rows matched: 4  Changed: 4  Warnings: 0

Query OK, 0 rows affected (0.00 sec)

Bye
$

In this example the root PW got set to my-new-and-secret-password.

Apache, mod_proxy, tomcat, two ip's on Debian

posted on 2014-07-31 13:45:12

To get an apache running to serve different ip's and sites at once, all on port 80, plus handing requests through to tomcat, this guide tries to explain the neccesary steps.

networking

First, set up a second ip for proper networking:

/etc/network/interfaces:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

#allow-hotplug eth0
auto eth0 
iface eth0 inet static
        address 10.0.0.21
        netmask 255.255.255.0
        network 10.0.0.0
        broadcast 10.0.0.255
        gateway 10.0.0.1

auto eth0:1
iface eth0:1 inet static
        address 10.0.0.22
        netmask 255.255.255.0

For security reasons, the actual subnet used was exchanged to 10.0.0.. Use your own. :)

IP 1 is 10.0.0.21, IP 2 is 10.0.0.22 here.

Do not forget to take the interface up afterwards:

$ ifdown eth0
$ ifup eth0

Also do not use service networking restart, it is a deprecated command.
Do not use ip l set eth0 down and ip l set eth0 up for this. It will bring the link back up, but you won't have ip addresses assigned. For more information, the iproute2 tool suite is really mighty, but you may need some more in-depth-knowledge.

Then

$ ip a

should show you something like this:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:25:90:ea:45:ac brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.21/24 brd 10.0.0.255 scope global eth0
    inet 10.0.0.22/24 brd 10.0.0.255 scope global secondary eth0:1

Then eth0 has state UP (not DOWN) and you see both IP's properly assigned. If you do not use a syntax like eth0:1 for the second ip in /etc/network/interfaces, you will only see one ip shown by the deprecated ifconfig command!

tomcat

Tomcat setting should best be left untouched, so it uses localhost and port 8080 to listen on.

/etc/tomcat7/server.xml:

...

   <Connector port="8080" protocol="HTTP/1.1"
              connectionTimeout="20000"
              URIEncoding="UTF-8"
              redirectPort="8443" 
              address="localhost"/>

...

If apache's mod_proxy was not be used, here for address the second ip could be set (10.0.0.22), and port to 80. However you'd need a linux system account, if you want to use a port below 1024. If you do not want this, you have to use either mod_proxy, mod_proxy_ajp, or mod_jk. The latter is the fastest and has most setting, but sure is more complex, too. mod_proxy_ajp is in between both, speed-wise. mod_proxy however works with any backend, not just tomcat or other servlet containers.

apache

ports.conf

/etc/apache2/ports.conf

Listen 80
Listen 443
NameVirtualHost 10.0.0.21:80
NameVirtualHost 10.0.0.21:443

Note that, you may need to drop the 443 lines, if you do not use https. The NameVirtualHost directive tells apache, to enable name-based virtual host support. This is needed, since our apache serves several domains. If the directive were to be omitted, then apache would only ever serve the first domain it would have in it's loading process. (Can be shown via apache2ctl -S.)

Since Tomcat serves only one site, no name-based virtual hosting is needed for it, thus no entry is needed.

virtualhost configs

Further is assumed, that you already have two existing vhost files, which are properly structured, are enabled and work, for each domain. The sites are named firstsite.de, secondsite.de and tomcatsite.org and already reside in /etc/apache2/sites-available.

First IP: 10.0.0.21

/etc/apache2/sites-available/000-firstsite.de

<VirtualHost 10.0.0.21:80>
    ServerName firstsite.de
    ServerAlias www.firstsite.de
    ...

/etc/apache2/sites-available/001-secondsite.de

<VirtualHost 10.0.0.21:80>
    ServerName secondsite.de
    ServerAlias www.secondsite.de
    ...

Second IP: 10.0.0.22

/etc/apache2/sites-available/002-proxy-for-tomcat

<VirtualHost 10.0.0.22:80>
    ServerName tomcatsite.org
    ServerAlias www.tomcatsite.org
    ...

    ProxyPass / http://localhost:8080/
    ProxyPassReverse / http://localhost:8080/
    ...

The 000-, 001- and 002- are just prefixes, to ensure the order of the pages being loaded.

mod_proxy

Enable the apache proxy module.

$ a2enmod proxy
$ a2enmod proxy_http

finish

Enable the vhost configs and restart the web server.

$ a2ensite 000-firstsite.de
$ a2ensite 001-secondsite.de
$ a2ensite 002-proxy-for-tomcat
$ service apache2 restart

linux: cat to clipboard

posted on 2014-07-21 11:13:46

To put the contents of a file directly into the clipboard, there exist several different ways. One possibility is to mark, CTRL-C or SHIFT-DEL, or whatever is used in you application for copying.

Applications like Klipper, besides providing the functionality of having a memory, also enable the system to copy every selection you make (with your mouse) into the clipboard.

All this is helpful, but once you have content that spans several screen pages, this gets old pretty fast.

Solution on debian: xclip

$ sudo apt-get install xclip

Usage:

$ echo test | xclip     ## clipboard contains now string 'test'
$ cat file.txt | xclip  ## clipboard contains content of file 'test.txt'

Downgrading packages in Debian / Ubuntu

posted on 2014-07-09 16:50:55

Downgrading packages can become important once an apt-get update && apt-get upgrade breaks something.

Most of the following must be done as root. Since you need to be for

Logs on what got upgraded

To find out the packages in question, look here:

/var/log/apt/term.log
/var/log/dpkg.log
/var/log/apt/history.log

Beware of the logrotating, in case you do not find anything. Use zgrep, zless, zcat on these .bz2 files.

A handy script to gather all information into on single place:

cd /var/log/apt && cat history.log > ~/apthistory.log && zcat history.log*gz >> ~/apthistory.log

That you all your logs get aggregated into apthistory.log in your homefolder.

If you are using synaptic, you can check the logs through it, too.

Find out which version to use

apt-cache showpkg <package>

Package is the name you usually use when using apt-get.

In the last section, you may find info on the version to use. It doesn't help that the manpage tells you to look at apt's source code for more information. (Yes, it does that for real...)

If you can't help but feeling lost, that's normal.

The other approaches are skimming through the aforementioned logs with grep and more grep. Or using google, which is harder than one might imagine.

Actual downgrading

apt-get install <packagename>=<version number>

Beware you might need the :amd64 or :i386 extension for the package name, too.

Preventing future upgrades from killing your changes

echo '<packagename> hold' | dpkg --set-selections

To undo this:

echo '<packagename> install' | dpkg --set-selections

To show what currently gets upgraded or not:

dpkg --get-selections | grep 'install'
dpkg --get-selections | grep 'hold'

Keep in mind that things might break in a later update & upgrade, if you do not fix the cause of your problem. The package you downgraded might be needed in a newer version by a lot of other packages, it's just a question of time.

Debian java update-alternatives

posted on 2014-05-21 06:23:43

If you need javaws with oracle java (not that IcedTea crap), and have it installed already, but lost your settings due to an update, do:

$ update-alternatives --config javaws

This will show you something like this:

There are 6 choices for the alternative javaws (providing /usr/bin/javaws).

  Selection    Path                                              Priority   Status
------------------------------------------------------------
* 0            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/javaws   1071      auto mode
  1            /usr/lib/jvm/j2re1.7-oracle/bin/javaws             316       manual mode
  2            /usr/lib/jvm/j2sdk1.7-oracle/jre/bin/javaws        317       manual mode
  3            /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/javaws   1061      manual mode
  4            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/javaws   1071      manual mode
  5            /usr/lib/jvm/java-7-oracle/bin/javaws              9         manual mode
  6            /usr/lib/jvm/java-7-oracle/jre/bin/javaws          1064      manual mode

Press enter to keep the current choice[*], or type selection number: 

Choose the according number and be happy.

Runlevel configuration in Debian

posted on 2014-05-15 14:43:12

Use sysv-rc-conf for this. It will show an curses GUI, where you can edit the present settings.

Get it from apt:

$ apt-get install sysv-rc-conf

Compile vim on Debian 7

posted on 2014-05-14 17:13:39

bare vim

First install mercurial if you do not have it already. Use hg --version to check.

$ apt-get install mercurial

Then get the vim sources and compile:

$ hg clone https://vim.googlecode.com/hg/ vim
$ cd vim/src
$ make

If it fails with an error like this one:

checking for tgetent in -ltinfo... no
checking for tgetent in -lncurses... no
checking for tgetent in -ltermlib... no
checking for tgetent in -ltermcap... no
checking for tgetent in -lcurses... no
no terminal library found
checking for tgetent()... configure: error: NOT FOUND!
      You need to install a terminal library; for example ncurses.
            Or specify the name of the library with
--with-tlib.
            make: *** [auto/config.mk] Error 1

Try installing an ncurses library:

$ apt-get install libncurses5

Afterwards all should be fine.

vim with python 3 support enabled

If however you desire specific functions (like using the powerline statusbar), you might need python support compiled into vim. Along with this there are some other things I need, too, which are shown below.

Enable it by preparing via ./configure:

./configure \
    --enable-python3interp \
    --with-python-config-dir=/usr/lib/python3.2/config-3.2mu \
    --with-x=yes \
    --with-features=normal \
    --disable-gui \
    --prefix=$HOME/dev/vim

This enables python 3 (for python 2, the command is the same, just lacking the '3'), the config dir is important, too.

X support is baked in for clipboard stuff, IIRC.
The featureset is normal. (See :h +feature for what is included.)
GUI is disabled since I never use gvim.
At last, the install directory is in $HOME/dev, because I prefer the vim install being there along with other dev tools.

python support install problems in detail

missing python dev packages

The tricky stuff for enabling python is to not forget the python dev packages, in my case via apt-get install python3-dev.
If python does not want to work, vim needs python's config dir location, and there has to be the config.c file located. Else installation will work, but you will not notice why it did now work as expected.

Try appending grep python -C3 via a pipe, i.e.

$ ./configure \
    --enable-python3interp \
    --with-python-config-dir=/usr/lib/python3.2/config-3.2mu \
    --with-x=yes \
    --with-features=normal \
    --disable-gui \
    --prefix=$HOME/dev/vim | grep python -C3`

That way you will be able to notice if the ./configure step is borked.

./configure's caching

Also, ./configure caches the steps it has made. This is the case when the ./configure ... output has (cached) appended. In this case just delete the config.cache file within the vim/src/auto folder.

Installing the Oracle JDK/JRE on Debian

posted on 2014-04-25 12:52:31

Sometimes you need the reference implementation (And not, i.e. the OpenJDK one that is easily available from the package repositories...) from the Oracle homepage. Might be you need exactly Java in v6 or v7 for IPMI for your Supermicro servers.

In this case several problem pop up:

  1. Oracle only provides .rpm and .tar.gz downloads.
  2. When getting the .tar.gz, might have problems installing it.
  3. Setting new package resources in /etc/apt/sources.list might also cause other problems, depending on the information you dig up from the internet.
  4. If No.3 works, you will run into the same trouble again, once you have to redo and regoogle what you did. (Of course this never happens. Haha.)
  5. Depending on what you install, you might miss the Java Web Start executable. Or it might be wrongly installed. (Of course, this never happens, either...)

So here is a better approach, which is easier to reproduce and will work.

First download the install of choice. (Choose the 32bit .tar.gz or the 64 bit one, according to your system. I.e. jdk-7u55-linux-x64.tar.gz)

$ apt-get install java-package
$ make-jpkg jdk-7u55-linux-x64.tar.gz

Say yes and ok, and let it work it's magic. Do not worry about error messages, at least in my case they were not of importance.

$ dpkg -i oracle-j2re1.7_1.7.0+update55_amd64.deb

And you are mostly done.

Only problem left might be that all is installed correctly, just the javaws not.

Check by running:

$ javaws

If this does not work, due to previously installed IcedTea implementation or whatnot, try this:

$ cd /etc/alternatives
$ ls java*

Then everything should point to the oracle install.

In my case everything did. Except the Web Start Link.

$ rm javaws
$ ln -s /usr/lib/jvm/java-7-oracle/bin/javaws javaws

Afterwards run

$ javaws

and you might see something like this:

[root@ctr-014 ~/Downloads]% javaws
Java(TM) Web Start 10.55.2.13-fcs 
Usage:  javaws [run-options] <jnlp-file>
        javaws [control-options]

where run-options include:
  -verbose              display additional output
  -offline              run the application in offline mode
  -system               run the application from the system cache only
  -Xnosplash            run without showing a splash screen
  -J<option>            supply option to the vm
  -wait                 start java process and wait for its exit

control-options include:
  -viewer               show the cache viewer in the java control panel
  -clearcache           remove all non-installed applications from the cache
  -uninstall            remove all applications from the cache
  -uninstall <jnlp-file>                remove the application from the cache
  -import [import-options] <jnlp-file>  import the application to the cache

import-options include:
  -silent               import silently (with no user interface)
  -system               import application into the system cache
  -codebase <url>       retrieve resources from the given codebase
  -shortcut             install shortcuts as if user allowed prompt
  -association          install associations as if user allowed prompt

Done.

This blog covers .csv, .htaccess, .pfx, .vmx, /etc/crypttab, /etc/network/interfaces, /etc/sudoers, /proc, 10.04, 14.04, AS, ASA, ControlPanel, DS1054Z, GPT, HWR, Hyper-V, IPSEC, KVM, LSI, LVM, LXC, MBR, MTU, MegaCli, PHP, PKI, R, RAID, S.M.A.R.T., SNMP, SSD, SSL, TLS, TRIM, VEEAM, VMware, VServer, VirtualBox, Virtuozzo, XenServer, acpi, adaptec, algorithm, ansible, apache, apache2.4, apachebench, apple, applet, arcconf, arch, architecture, areca, arping, asa, asdm, autoconf, awk, backup, bandit, bar, bash, benchmarking, binding, bitrate, blackarmor, blockdev, blowfish, bochs, bond, bonding, booknotes, bootable, bsd, btrfs, buffer, c-states, cache, caching, ccl, centos, certificate, certtool, cgdisk, cheatsheet, chrome, chroot, cisco, clamav, cli, clp, clush, cluster, coleslaw, colorscheme, common lisp, configuration management, console, container, containers, controller, cron, cryptsetup, csync2, cu, cups, cygwin, d-states, database, date, db2, dcfldd, dcim, dd, debian, debug, debugger, debugging, decimal, desktop, df, dhclient, dhcp, diff, dig, display manager, dm-crypt, dmesg, dmidecode, dns, docker, dos, drivers, dtrace, dtrace4linux, du, dynamictracing, e2fsck, eBPF, ebook, efi, egrep, emacs, encoding, env, error, ess, esx, esxcli, esxi, ethtool, evil, expect, exportfs, factory reset, factory_reset, factoryreset, fail2ban, fbsd, fdisk, fedora, file, filesystem, find, fio, firewall, firmware, fish, flashrom, forensics, free, freebsd, freedos, fritzbox, fsck, fstrim, ftp, ftps, g-states, gentoo, ghostscript, git, git-filter-branch, github, gitolite, global, gnutls, gradle, grep, grml, grub, grub2, guacamole, hardware, haskell, hdd, hdparm, hellowor, hex, hexdump, history, howto, htop, htpasswd, http, httpd, https, i3, icmp, ifenslave, iftop, iis, imagemagick, imap, imaps, init, innoDB, innodb, inodes, intel, ioncube, ios, iostat, ip, iperf, iphone, ipmi, ipmitool, iproute2, ipsec, iptables, ipv6, irc, irssi, iw, iwconfig, iwlist, iwlwifi, jailbreak, jails, java, javascript, javaws, js, juniper, junit, kali, kde, kemp, kernel, keyremap, kill, kpartx, krypton, lacp, lamp, languages, ldap, ldapsearch, less, leviathan, liero, lightning, links, linux, linuxin3months, lisp, list, livedisk, lmctfy, loadbalancing, locale, log, logrotate, looback, loopback, losetup, lsblk, lsi, lsof, lsusb, lsyncd, luks, lvextend, lvm, lvm2, lvreduce, lxc, lxde, macbook, macro, magento, mailclient, mailing, mailq, manpages, markdown, mbr, mdadm, megacli, micro sd, microsoft, minicom, mkfs, mktemp, mod_pagespeed, mod_proxy, modbus, modprobe, mount, mouse, movement, mpstat, multitasking, myISAM, mysql, mysql 5.7, mysql workbench, mysqlcheck, mysqldump, nagios, nas, nat, nc, netfilter, networking, nfs, nginx, nmap, nocaps, nodejs, numberingsystem, numbers, od, onyx, opcode-cache, openVZ, openlierox, openssl, openvpn, openvswitch, openwrt, oracle linux, org-mode, os, oscilloscope, overview, parallel, parameter expansion, parted, partitioning, passwd, patch, pct, pdf, performance, pfsense, php, php7, phpmyadmin, pi, pidgin, pidstat, pins, pkill, plasma, plesk, plugin, posix, postfix, postfixadmin, postgres, postgresql, poudriere, powershell, preview, profiling, prompt, proxmox, ps, puppet, pv, pveam, pvecm, pvesm, pvresize, python, qemu, qemu-img, qm, qmrestore, quicklisp, quickshare, r, racktables, raid, raspberry pi, raspberrypi, raspbian, rbpi, rdp, redhat, redirect, registry, requirements, resize2fs, rewrite, rewrites, rhel, rigol, roccat, routing, rs0485, rs232, rsync, s-states, s_client, samba, sar, sata, sbcl, scite, scp, screen, scripting, seafile, seagate, security, sed, serial, serial port, setup, sftp, sg300, shell, shopware, shortcuts, showmount, signals, slattach, slip, slow-query-log, smbclient, snmpget, snmpwalk, software RAID, software raid, softwareraid, sophos, spacemacs, spam, specification, speedport, spi, sqlite, squid, ssd, ssh, ssh-add, sshd, ssl, stats, storage, strace, stronswan, su, submodules, subzone, sudo, sudoers, sup, swaks, swap, switch, switching, synaptics, synergy, sysfs, systemd, systemtap, tar, tcpdump, tcsh, tee, telnet, terminal, terminator, testdisk, testing, throughput, tmux, todo, tomcat, top, tput, trafficshaping, ttl, tuning, tunnel, tunneling, typo3, uboot, ubuntu, ubuntu 16.04, udev, uefi, ulimit, uname, unetbootin, unit testing, upstart, uptime, usb, usbstick, utf8, utm, utm 220, ux305, vcs, vgchange, vim, vimdiff, virtualbox, virtualization, visual studio code, vlan, vmstat, vmware, vnc, vncviewer, voltage, vpn, vsphere, vzdump, w, w701, wakeonlan, wargames, web, webdav, weechat, wget, whois, wicd, wifi, windowmanager, windows, wine, wireshark, wpa, wpa_passphrase, wpa_supplicant, x11vnc, x2x, xfce, xfreerdp, xmodem, xterm, xxd, yum, zones, zsh


Unless otherwise credited all material Creative Commons License by sjas