Setup of ubuntu server or ubuntu desktop on VirtualBox
This tutorial will guide you to install and configure things like ubuntu 14.04, virtualbox, putty, apache, php, mysql, tweaking apache and php. Also give a brief intro to server administration panel called webmin.
Download & Install VirtualBox and download Ubuntu 14.04.
Once you have downloaded VirtualBox and Ubuntu click “Insert Guest Additions CD Image” and install it. It will enable features like shared clipboard,
Open terminal in Ubuntu and check ifconfig for valid IP. If you don’t find it in a adaptor. open interface file and add adaptor.
sudo nano /etc/network/interfaces |
Add lines in file
auto eth1 |
iface eth1 inet dhcp |
If you are running ubuntu 16.04, add these lines
auto enp0s8 |
iface enp0s8 inet dhcp |
Run the command in terminal to install ssh and aptitude. Remote access can only be possible via ssh.
apt-get update |
apt-get upgrade |
sudo apt-get install ssh openssh-server openssh-client aptitude |
Download Putty to access ubuntu server shell via windows machine by entering IP in putty.
Install apache, php, mysql, pear library,
sudo apt-get install apache2 libapache2-mod-php5 php5 php5-cli php5-dev php5-curl php5-gd php5-mysql php-pear build-essential libapache2-mod-php5 mysql-server libssh2-1-dev libssh2-php php5-xcache; |
For ubuntu 16.04
sudo apt-get install apache2 |
sudo apt-get install mysql-server mysql-client |
sudo apt-get install curl |
sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql php-gd |
sudo apt-get install php-imagick |
sudo apt-get update |
sudo service apache2 restart |
Install Mcrypt library for php7
sudo apt-get install php-mcrypt |
sudo phpenmod mcrypt |
sudo /etc/init.d/apache2 restart |
Install Monitoring tools
sudo apt-get install htop saidar iotop nano htop |
Install Webmin for server management
mkdir /opt/webmin; cd /opt/webmin; |
wget http://prdownloads.sourceforge.net/webadmin/webmin-1.670.tar.gz; |
tar -zxpf webmin-1.670.tar.gz; cd webmin-1.670; |
sudo ./setup.sh; |
/etc/webmin/start |
Login via IP or domain with port mentioned while installation of webmin. Eg: https://192.168.56.103:7777/ Once you are logged in.
Update webmin, if you get error of “Net::SSLeay” run these commands to install ssleay
sudo apt-get install libnet-ssleay-perl |
sudo apt-get install libcrypt-ssleay-perl |
sudo apt-get install libssl-dev |
We will create a new user because in near future we would be disabling root user for ssh.
sudo adduser newuser |
Or you can add a user with sudo privileges by this command and skip the below visudo step.
sudo adduser <username> sudo |
Give the user admin privileges and disable root user for ssh. Type command in terminal.
visudo |
Add the line for the user you want to give admin privileges.
newuser ALL=(ALL:ALL) ALL |
Go to webmin admin panel -> Server -> SSH Server -> Authentication -> Allow login by root? NO
You can check HostName of server. Go to webmin admin panel -> Networking -> Network Configuration -> Hostname and DNS Client -> Hostname = gumby
Apache configuration changes
Go to webmin admin panel -> Others -> PHP Configuration -> Edit Configuration Manually or edit file /etc/php5/apache2/php.ini
Change the following parameters
short_open_tag = On |
expose_php = Off |
error_reporting = E_ALL |
display_errors = On |
display_startup_errors = On |
post_max_size = 128M |
upload_max_filesize = 128M |
session.gc_probability = 1 |
Restart Apache to see the affect. Please run the following command to restart apache
sudo /etc/init.d/apache2 restart |
Go to webmin admin panel -> Servers -> Apache Webserver -> Global Configuration -> Configure Apache Modules or run the following command to enable modules
sudo a2enmod module_name |
Run the following command to disbale the module
sudo a2dismod module_name |
Now i would be installing recomened modules
sudo a2enmod expires; |
sudo a2enmod headers; |
sudo a2enmod rewrite; |
Change the directives of www virtual host
DocumentRoot /var/www/ |
<Directory /var/www/> |
allow from all |
Options +Indexes |
AllowOverride ALL |
</Directory> |
Give permissions to web server main directory
sudo chmod 777 /var/www/ |
Assign www-data user to web server main directory and root user group rights
sudo chown -R www-data:zalam /var/www/ |
Restart Apache to see the affect.
Leave a Reply