Ubuntu Server – Apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName

ubuntu-server-logo

Restarting the Apache Web Server on Ubuntu Server (12.04 at the time of writing) gives me the following error:

apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName

To fix this error add ServerName localhost to /etc/apache2/httpd.conf, as follows:

echo 'ServerName localhost' | sudo tee -a /etc/apache2/httpd.conf

Restart Apache to make sure that the issue is resolved:

sudo /etc/init.d/apache2 restart

Ubuntu Server – Unattended Installation (Custom CD)

ubuntu-server-logo

I’ve lost count of the number of times that I have installed Ubuntu Server on my VMware vSphere box – so I finally looked in to performing an unattended install.

I could have setup DHCP and TFTP servers and done PXE boot from images over the network – but I wanted to work on something quicker than that (and I don’t have that much spare RAM on my vSphere box as it is).

So I settled on re-mastering an Ubuntu Server .iso image. The result is an unattended install, except for the initial boot screen (where I need to select a minimal virtual machine installation anyway).

The following steps were performed on Ubuntu Desktop.

Download Ubuntu Server – I am using the 32 bit version of Ubuntu 12.04.

Open a Terminal and create a directory to mount the Ubuntu Server iso to.

sudo mkdir -p /mnt/iso

The -p switch is very useful as it allows you to create a directory structure which does not already exist (as opposed to creating a single directory).

Change directory to Downloads:

cd Downloads

I renamed my download UbuntuServer.iso.

Mount UbuntuServer.iso to /mnt/iso:

sudo mount -o loop UbuntuServer.iso /mnt/iso

Create a directory and copy the mounted Ubuntu Server files:

sudo mkdir -p /opt/serveriso
sudo cp -rT /mnt/iso /opt/serveriso

The -r switch copies directories recursively and -T specifies no (singular) target directory.

Now we have a copy of our Ubuntu .iso to work on in /opt/serveriso – but we need to make these files writable:

sudo chmod -R 777 /opt/serveriso/

With this preparation done we can start customizing things.

If we look at the isolinux/langlist file we see all the supported languages listed that Ubuntu supports (in an abbreviated format):

am
ar
ast
be
bg ...

I am only interested in an English install so I am going to overwrite the contents of isolinux/langlist with the single abbreviation for English, which is “en”.

cd /opt/serveriso
echo en >isolinux/langlist

This stops the language selection menu from appearing during installation.

The next step of the process is to create a kickstart file – this will provide the server install with the answers to the various questions asked during installation, such as timezone, username, password, partition structure and so on.

Install Kickstart Configurator:

sudo apt-get install system-config-kickstart

Click the Dash button and type kickstart and then click on the kickstart application.

kickstart

Obviously you should customize your settings as you see fit – I have provided mine for reference.

Basic Configuration
Basic Configuration: Set Timezone
Installation Method
Installation Method: Choose the CD-ROM installation method

Boot Loader Options

Partition Options: Add an ext4 partition to the root file system that fills all unused space on the disk
Partition Options: Add an ext4 partition to the root file system that fills all unused space on the disk
Partition Options: Add a swap file system that uses the recommended swap size
Partition Options: Add a swap file system that uses the recommended swap size
Network Configuration: Add network device eth0 and set to DHCP
Network Configuration: Add network device eth0 and set to DHCP
User Configuration: Provide username and password
User Configuration: Provide username and password

Click File, Save File and save the kickstart file ks.cfg to /opt/serveriso.

While using the Kickstart Configurator you may have noticed that the Package Selection screen did not work. Fortunately we can manually edit the ks.cfg file so that the packages that we want are installed during Ubuntu Server installation.

At the end of ks.cfg add %packages and then list the packages that you want installed. I chose to install nano, openssh-server and open-vm-tools:

%packages
nano
openssh-server
open-vm-tools --no-install-recommends

–no-install-recommends installs open-vm-tools in headless mode.

Now we need to configure the CD boot command line to use the kickstart ks.cfg file.

Browse to and open /opt/serveriso/isolinux/txt.cfg.

We need to edit the append line of the default install section at the top of the file.

default install

At the end of the append line add ks=cdrom:/ks.cfg. You can remove quiet — and vga=788.

My append line is as follows:

append  file=/cdrom/preseed/ubuntuserver.seed initrd=/install/initrd.gz ks=cdrom:/ks.cfg

The final step is to create a new Ubuntu Server .iso using this command:

sudo mkisofs -D -r -V "ATTENDLESS_UBUNTU" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o /opt/autoinstall.iso /opt/serveriso

The finished .iso is /opt/autoinstall.iso.

Test your .iso in a virtual machine to make sure that everything works as it should.

The minimal interaction that I need to set my Ubuntu Server install going is documented below:

1. Press the Enter key to confirm the English language selection
Press the Enter key to confirm the English language selection
Press F4, select Install a minimal virtual machine, and then press Enter
Press F4, select Install a minimal virtual machine, and then press Enter
Press Enter to install Ubuntu Server
Press Enter to install Ubuntu Server

From here installation continues without any further input being required.

Sources: http://askubuntu.com/questions/122505/how-do-i-create-completely-unattended-install-for-ubuntu

Ubuntu Server – Very Quick FTP Setup

ubuntu-server-logo

To get an FTP daemon running on Ubuntu Server we will install vsftpd (Very Secure FTP Daemon) as follows:

sudo apt-get update
sudo apt-get install vsftpd

The next step is to configure vsftpd by editing the /etc/vsftpd.conf file. Issue the following commands to install the nano editor (if you haven’t installed it before) and edit the file:

sudo apt-get install nano
sudo nano /etc/vsftpd.conf

The basic configuration of vsftpd.conf involves simple editing and un-commenting of the existing parameters:

Un-commenting is the removal of the # sign from the start of a line. For example changing #local_enable=YES to local_enable=YES (which we will do later).

  • To disable anonymous access change anonymous_enable=YES to anonymous_enable=NO.
  • Un-comment #local_enable=YES to allow local users to login to the FTP server.
  • Un-comment #write_enable=YES if you want users to be able to upload to the FTP server.

Vsftp.conf contains an explanation of its parameters – so it should be relatively self-explanatory if you wish to configure other options.

The final step is to restart the vsftp daemon. On older Ubuntu servers you will probably use sudo /etc/init.d/vsftpd restart but a more recent installation will prefer:

sudo service vsftpd restart

Enjoy!

ViMP – Upgrading From Version 2.2.x to 2.5 (Ubuntu Server 10.4 Lucid)

Yesterday I finally upgraded ViMP Community Edition to 2.2.x and so today I am upgrading to 2.5.x.

At the time of writing the latest version of ViMP is vimp.framework-2.5.4-r19900-community.tar.gz – which can be downloaded from here.

For clarification my system variables are as follows (obviously you may need to change them if yours are different):

  • ViMP installation directory – /var/www/showvid/data/
  • MySQL user – root
  • MySQL ViMP database – showvid

The upgrade process was as follows.

First backup the ViMP directory and copy the ViMP tarball to your server.

Copy the tarball to /var/www/showvid/data:

sudo cp vimp.framework-2.5.4-r19900-community.tar.gz 
/var/www/showvid/data/

Change directory to /var/www/showvid/data/:

cd /var/www/showvid/data/

Extract the vimp-framework tarball:

sudo tar xvzf vimp.framework-2.5.4-r19900-community.tar.gz

Delete lib/auth/stAuthProvider.php

cd /lib/auth/
sudo rm stAuthProvider.php

Next we need to run the data/sql/updates.sql file from the ViMP tarball – make sure that you extract the tarball on your computer so that you can import it to your server.

Note: there are other .sql files in the sql folder but they are only used if you have modules installed etc.

Updates.sql can be run from the command line but I found it easier to use phpmyadmin – which can be installed as follows:

sudo apt-get install phpmyadmin

I selected Apache2 as the webserver to reconfigure and then selected No to configure a database for phpmyadmin. Open a browser and open phpmyadmin on your ViMP server: http:\\<server-ip>\phpmyadmin. Log in with root and your mysql password.

Select the showvid database in the left hand panel and then click the import tab. Click the Browse button and select updates.sql in the data/sql folder. Then click the Go button.

Finally change directory to /var/www/showvid/data and rebuild the ViMP installation:

sudo ./symfony rebuild
sudo ./symfony i18:import

I did get an error when I imported updates.sql but ViMP did successfully upgrade.

ViMP – Upgrading From Version 2.1.x to 2.2 (Ubuntu Server 10.4 Lucid)

This post has been in my drafts folder for about a year as I had an unresolved issue trying to upgrade to ViMP version 2.2x. I finally had time to look at it again today and everything went smoothly – and I can’t remember what I did differently when it was not working. Note that I do not have any modules installed in ViMP and so I am not covering how to upgrade them (see here).

For clarification my system variables are as follows (obviously you may need to change them if yours are different):

  • ViMP installation directory – /var/www/showvid/data/
  • MySQL user – root
  • MySQL ViMP database – showvid

The upgrade process was as follows.

First I updated my Ubuntu 10.4 Server:

sudo apt-get update
sudo apt-get upgrade

Next backup the ViMP directory and then download vimp.framework-2.2.1-r19622-community.tar.gz from here.

Copy vimp.2.2.1 to the home directory of your ViMP server and then copy it from the home directory to /var/www/showvid/data:

sudo cp vimp.framework-2.2.1-r19622-community.tar.gz 
/var/www/showvid/data/

Change directory to /var/www/showvid/data/:

cd /var/www/showvid/data/

Delete the lib directory:

sudo rm -Rf lib/

Change directory to config:

cd config/

Delete databases.yml and propel.ini:

sudo rm databases.yml
sudo rm propel.ini

Return to the data directory and delete the contents of the cache directory:

cd ..
sudo rm -Rf cache/*

Extract the vimp-framework tarball:

sudo tar xvzf vimp.framework-2.2.1-r19622-community.tar.gz

Configure the showvid database and rebuild the ViMP installation:

sudo ./symfony configure:database mysql://DBUSER:DBPASSWORD@localhost
/DBNAME
sudo ./symfony rebuild
sudo ./symfony i18:import

Here my DBUSER is root and DBNAME is showvid.

Now that I have finally upgraded to 2.2.1 I can start work on upgrading to 2.5.x!

Ubuntu Server 10.4 Lucid – add-apt-repository: command not found

Since Ubuntu 9.10 (Karmic Koala) users have been able to add PPAs (Personal Package Archives) to install packages via the command line as follows:

sudo add-apt-repository ppa:<repository name>

Typically this works out of the box, but not with a minimal Ubuntu Server installation (such as I use in my VMware vSphere environment) which produces the following error:

sudo: add-apt-repository: command not found

The solution is to install python-software-properties:

sudo apt-get install python-software-properties

Source: Ubuntu Forum

.

Ubuntu Server 10.4 Lucid – Upgrading Feng Office (Community Edition)

It turns out that upgrading Feng Office is actually very simple. I had installed Feng Office Community Edition version 1.7.4 recently and a few days ago found out that version 1.7.5 had been released.

It is advisable to backup your current installation before upgrading.

Log in to Feng Office as Admin and then click the Administration link:

Click the Upgrade button:

Click Start automatic upgrade:

Wait a couple of minutes and then log back in to your new version of Feng Office.