Thursday, 15 October 2015

Set up a server using Webmin Control Panel

We will be using below steps to set up a server using Webmin Control Panel and Ubuntu.

Operating System : Ubuntu 14.04 LTS
Control Panel : Webmin
Database : MySQL Server 5.6
Web Server : Apache web server
Database Management : PhpMyAdmin
DNS : BIND Name Server
FTP : ProFTP server


1. Set server hostname. Select a randomly generated server name from :

http://www.computernamer.com/

Edit /etc/hosts and /etc/hostname to add the new hostname

hostname newhostname

reboot the server and make sure that hostname persists

2. Install virtualmin. If the server is below 3GB,RAM using virtualmin for low memory https://www.virtualmin.com/documentation/system/low-memory

and use Ubuntu 14.04 LTS 32 bit operating system

cd /usr/local/src/

wget http://software.virtualmin.com/gpl/scripts/install.sh

/bin/sh install.sh

3. Create swap memory for the server

fallocate -l 4G /swapfile

chmod 600 /swapfile

mkswap /swapfile

swapon /swapfile

swapon -s

Open /etc/fstab and add below line at the end of the file:

/swapfile   none    swap    sw    0   0

4. Login to virtualmin panel

https://server-ip:10000/

As it is a low memory server, use the default option (don't enable anything except mysql)

set mysql root password : mysql_root_pass

5. Create Virtual Server

website/password

6.Download the mysql backup and site files to new server

cd /usr/local/src/

wget -r ftp://server-ip/public_html/website_name --user username --password 'my_pass'

7. Source the mysql dump to new database

Login to mysql terminal

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| my_site_db         |
| mysql              |
| performance_schema |
+--------------------+
4 rows in set (0.00 sec)

mysql> use my_site_db
Database changed
mysql> show tables;
Empty set (0.00 sec)

mysql> source my_site_db.sql;

CREATE USER 'my_site_db_username'@'localhost' IDENTIFIED BY 'my_site_db_pass';

GRANT ALL PRIVILEGES ON my_site_db. * TO 'my_site_db_username'@'localhost';

flush privileges;


Check the website by adding to hosts file : http://www.howtogeek.com/howto/27350/beginner-geek-how-to-edit-your-hosts-file/

8. Sign up with Cloud Flare

Sign up with cloudflare.com which will improve the security of the website and also make it faster. You can see the features of cloudflare : https://www.cloudflare.com/features-cdn

Use the free plan :https://www.cloudflare.com/a/sign-up

9. Sign up with ZoHo for mail

Use ZoHo Mail for the email : https://www.zoho.com/mail/help/adminconsole/add-domains.html

10. Install phpmyadmin

apt-get install phpmyadmin

php5enmod mcrypt

vim /etc/apache2/conf-available/phpmyadmin.conf and add AllowOverride All and it will look like :
<Directory /usr/share/phpmyadmin>
        Options FollowSymLinks
        DirectoryIndex index.php
        AllowOverride All


service apache2 restart

http://server-ip/phpmyadmin

vim /usr/share/phpmyadmin/.htaccess
AuthType Basic
AuthName "Restricted Files"
AuthUserFile /etc/phpmyadmin/.htpasswd
Require valid-user

apt-get install apache2-utils

htpasswd -c /etc/phpmyadmin/.htpasswd phpmyadmin_user

phpmyadmin_user / phpmyadmin_pass






No comments:

Post a Comment