Some basic steps for Ubuntu Web Server installation. Each step is well explained. The truth is I stolen all these materials from the Internet (and to be honest), I don’t remember the resource :)
1. Install Apache2 web server
To install Apache you must install the Metapackage apache2. This can be done by searching for and installing in the Software Centre, or by running the following command.
sudo apt-get install apache2
2. Install Mysql
To install MySQL you must install the Metapackage mysql-server. This can be done by searching for and installing in the Software Centre, or by running the following command.
sudo apt-get install mysql-server
3. Install PHP
To install PHP you must install the Metapackages php5 and libapache2-mod-php5. This can be done by searching for and installing in the Software Centre, or by running the following command.
sudo apt-get install php5 libapache2-mod-php5
4. Restart Server
Your server should restart Apache automatically after the installation of both MySQL and PHP. If it doesn’t, execute this command.
sudo /etc/init.d/apache2 restart
5. Check Apache2 web server
Open a web browser and navigate to http://localhost/ or the ip of your server. You should see a message saying It works, or you’ll see a loaded web page from apache.
6. Check PHP
You can check your PHP by executing any PHP file from within /var/www/. Alternatively you can execute the following command, which will make PHP run the code without the need for creating a file .
php -r 'echo "\n\nYour PHP installation is working fine.\n\n\n";'
7. Install FTP server
vsftpd is an FTP daemon available in Ubuntu. It is easy to install, set up, and maintain. To install vsftpd you can run the following command:
apt-get install vsftpd
By default vsftpd is configured to authenticate system users and allow them to download files. If you want users to be able to upload files, edit /etc/vsftpd.conf:
write_enable=YES chroot_local_user=YES
FTP can also be encrypted using FTPS. Different from SFTP, FTPS is FTP over Secure Socket Layer (SSL). SFTP is a FTP like session over an encrypted SSH connection. A major difference is that users of SFTP need to have a shell account on the system, instead of a nologin shell. Providing all users with a shell may not be ideal for some environments, such as a shared web host. However, it is possible to restrict such accounts to only SFTP and disable shell interaction. See the section on OpenSSH-Server for more.
To configure FTPS, edit /etc/vsftpd.conf and at the bottom add:
ssl_enable=Yes
Also, notice the certificate and key related options:
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
By default these options are set to the certificate and key provided by the ssl-cert package. In a production environment these should be replaced with a certificate and key generated for the specific host. For more information on certificates see Certificates.
Now restart vsftpd, and non-anonymous users will be forced to use FTPS:
service vsftpd restart