Ubuntu Tips

From JoeHacker

Server Documentation

Ubuntu has put up really nice documentation for configuring servers. https://help.ubuntu.com/9.04/serverguide/C/index.html

General Changes

dash is the default shell linked to /bin/sh. This can cause a number of problems with some scripts. To change /bin/sh back to bash use the following command.

dpkg-reconfigure dash

Admin Commands

allow a user to sudo

sudo adduser <username> 
sudo adduser <username> admin


Apache

remake ssl snakeoil cert

sudo make-ssl-cert generate-default-snakeoil --force-overwrite

Disable default site

a2dissite default

Enable ldap

a2enmod authnz_ldap

LDAP TLS

The following line needs to be defined in /etc/ldap/ldap.conf

TLS_CACERT      /etc/ssl/certs/[CA_CERT.pem]

Where CA_CERT.pem is your Root CA.

Helpful page to configure ldap server https://help.ubuntu.com/8.10/serverguide/C/openldap-server.html

Wireless Keys

It remove a saved passphase for a wireless connection that NetworkManager uses, the following command will let you update the keys. The are on the Password tab.

seahorse

Building Help

Debian source packages need a debian directory in the extracted source tree to build a package. There are plenty of sites that explain what those files are and how to create them. These are my shortcut notes to modify a package. I'll expand this section when I know more.

An an example, I wanted to get the newest version of luma packaged. I downloaded luma-2.4 and saved the tar. I then ran the following and got the current source for luma.

apt-get source luma

It created the luma-2.3 directory structure. I extracted the new tar and copied the debian directory to the new directory.

tar -xvjf luma-2.4.tar.bz2
cp -a luma-2.3/debian luma-2.4/.

Now I needed to update the changelog and change the version information.

cd luma-2.4/debian
dch -i
cd ..

After adding the comments for the new version, I built the package.

dpkg-buildpackage -rfakeroot


General Troubleshooting

Apt-cacher-ng

THis one took a while to figure out while trying to do an upgrade. I've seen numerous problems with trying to use apt-cacher-ng with the upgrade process, but this one was caused by a corrupted file in the cache. When trying an upgrade, I got the following error

Checking for a new ubuntu release
Failed Upgrade tool signature
Done Upgrade tool
Done downloading            
extracting 'jaunty.tar.gz'
authenticate 'jaunty.tar.gz' against 'jaunty.tar.gz.gpg' 
exception from gpg: GnuPG exited non-zero, with code 131072
Debug information: 
...

It turns out that /var/lib/update-manager/meta-release was corrupt and everytime I edited the file the corruption came back. I removed the file from apt-cache-ng cache directory, retried the upgrade and everything was fixed.

rm /var/cache/apt-cacher-ng/changelogs.ubuntu.com/meta-release

Adding Keys to Apt

I have added some launchpad repos and keep forgetting how to add the keys to prevent apt errors. Here is basically the command to use.

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 12345678

Replace 12345678 with the key id.

Disable IPv6 on Karmic 9.10

grub-editenv /boot/grub/grubenv set GRUB_CMDLINE_EXTRA=ipv6.disable
grub-mkconfig -o /boot/grub/grub.cfg

Links

Here are some useful links