Jump to content

Building WebHost Server


shadowmac
 Share

Recommended Posts

Here are some instructions on how to build your very own Webhost Server



This is a basic installation tutorial for the CentOS operating system for dedicated server duties !



CentOS is a free whitelabel distro of RedHat Enterprise with all the bells and whistles, and is the OS of choice for many web hosting companies



Assumptions:


  • 250GB Harddrive
  • 512MB RAM



Installing the OS using ‘Text Mode’ :



  1. Insert the first Linux installation CD-ROM (disc 1) in the CD-ROM drive of your server and restart the server.
  2. At the boot: prompt, type linux text and press the Enter key. This starts the installation process.
  3. On the Language Selection screen, select English as the language that you want to run the installation program in, then click OK.
  4. On the Keyboard Selection screen, select the keyboard attached to your server, then click OK.
  5. On the Mouse Selection screen, select the mouse attached to your server, then click OK.
  6. On the Welcome screen, review the installation information, then click OK.
  7. On the Partitioning Type screen, select Create Custom, then click OK.
  8. On the Disk Partitioning Setup screen, select Disk Druid. Quote: - If your disk has existing partitions, select each partition and click Delete.
  9. Create the following disk partitions:


(The following partitions are recommended prior to installing cPanel)


  • 15 GB /
  • 500 MB /boot (No seperate /boot for FreeBSD)
  • 2 GB /tmp
  • 40 GB /usr
  • 40 GB /var
  • 1 GB swap (swap should be 2x RAM)
  • Remaining space to /home



To create the / partition ‘root’:


* On the Partitioning screen (see step 8 ) , click New.


* In the Mount Point field, type / .


* For the Filesystem type select ext3.


* In the Size (MB) field, type 15360, then click OK.



To create the /boot partition:


* On the Partitioning screen (see step 8 ) , click New.


* In the Mount Point field, type /boot.


* For the Filesystem type select ext3.


* In the Size (MB) field, type 500, then click OK.



To create the /tmp partition


* On the Partitioning screen (see step 8 ) , click New.


* In the Mount Point field, type /tmp .


* For the Filesystem type select ext3.


* In the Size (MB) field, type 2048, then click OK.



To create the /usr partition


* On the Partitioning screen (see step 8 ) , click New.


* In the Mount Point field, type /usr .


* For the Filesystem type select ext3.


* In the Size (MB) field, type 40960, then click OK.



To create the /var partition


* On the Partitioning screen (see step 8 ) , click New.


* In the Mount Point field, type /var .


* For the Filesystem type select ext3.


* In the Size (MB) field, type 40960, then click OK.



To create the swap partition


* On the Partitioning screen (see step , click New.


* For the Filesystem type field, select swap.


* In the Size (MB) field, enter a number that is twice the current RAM (1024 If you are using 512MB Ram), then click OK.



To create the /home partition


* On the Partitioning screen (see step , click New.


* In the Mount Point field, type /home.


* For the Filesystem type select ext3.


* In the Size (MB) field, select Fill all available space, then click OK.



10 – When finished, Click OK.


11 – On the Boot Loader Configuration screen, select LILO Boot Loader, then click OK.


12 – On each of the following three screens, click OK.


13 – On the Network Configuration screen, clear Use bootp/dhcp, enter your server network configuration, then click OK.


14 – On the Hostname Configuration screen, enter the fully qualified host name of your server, then click OK.


15 – On the Firewall Configuration screen, select No firewall, then click OK.


16 – On the Language Support screen, select English (USA), then click OK.


17 – On the Time Zone Selection screen, select the location, then click OK.


18 – On the Root Password screen, enter in the root password for your server, re-enter the password to confirm it, then click OK.


19 – If you want to create an account that you can use to remotely log on to your server using SSH or FTP, click Add.


*** Provide the login name and password, then click OK.


20 – Review the information on the User Account Setup screen, then click OK.


21 – Review the information on the Authentication Configuration screen, then click OK.


22 – On the Package Group Selection screen, verify that only the following packages are selected. Clear all other check boxes.


. Network Support


. Messaging and Web Tools


. DNS Name Server


. Network Managed Workstation


. Software Development


Trying a load with just the following:


. Base Package


. Development Libraries


. DNS Name Server


. Editors


. FTP Server


23 – Click OK.


24 – Review the Installation to begin screen, then click OK.


25 – Insert the second/third installation CD-ROM when notified to, then click OK.


26 – To create a boot disk, click Yes. Otherwise, click No.


27 – When done, the installation complete screen displays.


28 – Click OK, then press Enter to restart.


Checking the host name and network settings :


After your first boot, you must check your system’s host name and network configuration to ensure that they are correct. To check your system’s host name and network configuration:


- Log on to the system as the root user.


- Type vi /etc/hosts to open the host file and modify the contents.


- Verify that the file is in the following format:



- Verify that the loopback entry (127.0.0.1) appears in the file. A correctly configured file should look like this: Note : The IP addresses used here are for illustration purposes only; they are not valid values.


# Do not remove the following line, or various programs


# that require network functionality will fail.


127.0.0.1 localhost.localdomain localhost


10.1.1.1 myhost.mydomain.com myhost – Modify the file as needed.


- Type :wq to close the file.


- Type vi /etc/sysconfig/network to open the network sysconfig file and modify the contents.


- Verify the host name. A correctly configured file should look like this: Note : The IP addresses used here are for illustration purposes only; they are not valid values.


NETWORKING=yes


HOSTNAME=myserver.mydomain.com


GATEWAY=10.100.0.1 – Modify the file as needed.


- Type :wq to close the file.


- Type vi /etc/sysconfig/network-scripts/ifcfg-eth0 to open the network scripts file and modify the contents.


- Verify that network information. A correctly configured file should look like this: Note : The IP addresses used here are for illustration purposes only; they are not valid values.


DEVICE=eth0


BOOTPROTO=static


BROADCAST=10.1.1.1


IPADDR=10.1.1.1


NETMASK=255.255.0.0


NETWORK=10.1.0.0


ONBOOT=yes – Modify the file as needed.


- To make these changes active, restart the system by typing:


shutdown -r now 





If you happen to be running CentOS in a VMware session, now is the time to install vmware-tools

Click Install VMware Tools

[root@localhost]#mount /dev/hdc /media

[root@localhost]#ls /media

[root@localhost]#tar -C /tmp -zxvf /media/VMwareTools-7.9.6-173382.tar.gz

[root@localhost]#umount /media

[root@localhost]#/tmp/vmware-tools-distrib/vmware-install.pl

[root@localhost]#/usr/bin/vmware-toolbox

[root@localhost]#shutdown -r now

Link to comment
Share on other sites

Log into your server as root via the console or SSH.





Ensure your resolvers are working by trying to resolve cpanel.net



[root@localhost]# nslookup cpanel.net










Note: If nslookup does not work, giving a 'command not found' error, you can use yum to install the necessary packages.



[root@localhost]# yum install bind-utils.i386










Note: If you get an error about not being able to resolve the host, you need to edit your /etc/resolv.conf and add proper resolvers. For servers in our network, the following command will suffice. If you are not in our datacenter, you will need to find out your host's DNS info:



[root@localhost]# echo -e "nameserver 10.58.128.39\nnameserver 10.59.128.39" >> /etc/resolv.conf










Change directory into your /home



[root@localhost]# cd /home










Satisfy cPanel's pre-requisites:



[root@localhost]# yum -y install wget perl screen










Download cPanel's installer:



[root@localhost]# wget http://layer1.cpanel.net/latest










Start a screen session so you can resume the cPanel install at a later time to check on it's status if you close the window or lose connection:



[root@localhost]# screen -S cpanel_install










To resume the screen if you are disconnected:



[root@localhost]# screen -r cpanel_install










Now run the installer using sh or bash:



[root@localhost]# sh latest





The installer is now running and may take a hour to two depending on your servers hardware, OS, connection speed, etc.





Once the installation is complete it's now time to log into the WebHostManager (WHM) and go through the wizard. Point your browser to http://your_ip_here/whm or http://your_ip_here:2086/ . You will be prompted for a user/pass, enter root as the user and enter your root password in the password field. The wizard will now launch and ask you a few questions. Once complete your system is ready to use!



Link to comment
Share on other sites

To install Fantasico on your cPanel/WHM server, SSH to your server and enter following commands, one per line (you may also copy/paste):





[root@localhost]# cd /usr/local/cpanel/whostmgr/docroot/cgi


[root@localhost]# wget -N http://files.betaservant.com/files/free/fantastico_whm_admin.tgz


[root@localhost]# tar -xzpf fantastico_whm_admin.tgz


[root@localhost]# rm -rf fantastico_whm_admin.tgz










Now go to WHM -> Add-Ons (Plugins on v11.x or higher) -> Fantastico De Luxe WHM Admin (scroll down the left menu).







Follow the on screen instructions.







If you get a Source Guardian error when you go to Fantastico for the first time, just run this command:







[root@localhost]# chmod -R 0755 /usr/local/cpanel/3rdparty/etc/ixed










After the installation is complete, click on "Settings" and go through the settings. While some settings are not important, some other (marked below with an *) are essential for a proper functioning of Fantastico installations:







Language: Select the language for the admin backend AND default language for users without a language selected.







Email notifications: Enter an email address in order to receive notifications when users perform installations using Fantastico.







Master files settings (*): If you are not an advanced user who modifies the master files, leave this to "Remove". Change this only if you know what you are doing







PHPsuexec (*): VERY ESSENTIAL!!! Changing this value will not install or de-install phpsuexec for you. It will only tell Fantastico that you have phpsuexec installed or not installed on your server. Change to "installed" if you perform installations which produce an "Internal Server Error". Notice: Changes will not apply to existing installations! You have to re-install in order to have working installations.







Path to netPBM: Enter the full path to the netPBM binaries in order to enable Gallery installations. As long as this field has no value, your users will not be able to install Gallery.







Select Fantastico licensing and files server: If the Fantastico pages take long to load switch to the server that works best for you. Fantastico will auto-switch if connections time out.







Update preference: Select latest version (sometimes experimental) or stable version (best working).







If your users don't see a Fantastico link in their cPanel: Go to WHM and edit the "default" Features List. Activate Fantastico.







Caveat emptor: Centos 5.x (as well as some newer versions of Fedora Core) come with a wget version that is not compatible with Fantastico. Here are the steps that you need to take to remove buggy version of wget and install a working one :







[root@localhost]# rpm -qa wget


[root@localhost]# wget http://mirrors.kernel.org/fedora/core/5/i386/os/Fedora/RPMS/wget-1.10.2-3.2.1.i386.rpm


[root@localhost]# rpm -e wget


[root@localhost]# rpm -ivh –force wget-1.10.2-3.2.1.i386.rpm


[root@localhost]# rpm -qa wget


Link to comment
Share on other sites

Here is a step-by-step guide on installing ImageMagick:





Log into your server as root via SSH or the VPS console.





Ensure that the RPM versions of ImageMagick are installed:



[root@localhost]# yum install ImageMagick ImageMagick-devel










Install the ImageMagick PECL extension:



[root@localhost]# pecl install imagick










Restart Apache:



[root@localhost]# /scripts/restartsrv_apache





That's it, ImageMagick should now be installed and ready for use!



Link to comment
Share on other sites

Looking at installing Webmin (FREE) in place of cPanel (EXPENSIVE).





Here is all you need to do to get it installed:





It is good practice to NOT use your root account for server maintenance. So let us create a second root user for these types of actions



login: root


Password:



[root@xyz ~]# passwd



Changing password for user root.


New UNIX password:


Retype new UNIX password:



passwd: all authentication tokens updated successfully.



[root@localhost]# adduser secondrootuser



[root@localhost]# passwd secondrootuser



Changing password for user secondrootuser.



New UNIX password:


Retype new UNIX password:


passwd: all authentication tokens updated successfully.



[root@localhost]#



[root@localhost]# exit



NOW log back in as su user




login: secondrootuser



Password:



[secondrootuser@localhost]$ su root


Password:










This will install some dependencies.



[secondrootuser@localhost]# yum -y install perl-Net-SSLeay










Go to Browse Webmin Files on SourceForge.net and note the latest version







Install the system :



[secondrootuser@localhost]# cd /usr/src


[secondrootuser@localhost]# wget http://sourceforge.net/projects/webadmin/files/webmin/1.480/webmin-1.480-1.noarch.rpm/download (latest version)


[secondrootuser@localhost]# rpm --import http://www.webmin.com/jcameron-key.asc


[secondrootuser@localhost]# yum localinstall webmin-1.480-1.noarch.rpm










After you've completed the installation, you should be able to access your webmin panel at Ecommerce Web Site Hosting by YourHost.com Ecommerce Web Site Hosting by YourHost.com







Log in as root.



Note: If on typing the URL in browser, you get a no page found message. Make sure Webmin is running.







Start Webmin: using command line



[secondrootuser@localhost]#/etc/webmin/start










using your sudo root



[secondrootuser@localhost]#sudo /etc/webmin/start










you can also restart webmin by



[secondrootuser@localhost]#sudo /etc/webmin/restart










Set Webmin to Auto Start on Server Startup.



[secondrootuser@localhost]#chkconfig --level 23 webmin on


[secondrootuser@localhost]#chkconfig --list webmin










Note: if chkconfig is not installed you can install it by



[secondrootuser@localhost]#yum -y install chkconfig


Link to comment
Share on other sites

OpenVZ virtualization uses the concept of containers to run Linux only instances on the same hardware. OpenVZ is an operating system-level virtualization technology. It allows a physical server to run multiple isolated different Linux distributions operating system instances, known as containers or Virtual Private Servers (VPS's)





OpenVZ doesn't have the overhead of a true hypervisor (e.g. XEN or VMware), so it is very fast and an efficient to run Linux only VPS. All virtual servers will use same Linux kernel version.





It offers strong isolation. This is perfect for running named, mysqld, apache and other services in each container. Each VPS is a separate entity, and behaves just like a physical server. Each VPS has:



  • System files (such as /bin, /sbin, /lib etc);
  • Own root users, as well as other users and groups;
  • Process tree;
  • Network (private or public IP;
  • Shared memory, semaphores, messages.





Default Locations



  • /vz - Main directory for OpenVZ.
  • /vz/private - Each VPS is stored here i.e. container's private directories
  • /vz/template/cache - You must download and store each Linux distribution template here.
  • /etc/vz/ - OpenVZ configuration directory.
  • /etc/vz/vz.conf - Main OpenVZ configuration file.
  • /etc/vz/conf - Softlinked directory for each VPS configuration.
  • Network port - No network ports are opened by OpenVZ kernel.





Install OpenVZ on CentOS



In order to install OpenVZ, we need to add the OpenVZ repository to yum:



[root@localhost]# cd /etc/yum.repos.d


[root@localhost]# wget http://download.openvz.org/openvz.repo


[root@localhost]# rpm --import http://download.openvz.org/RPM-GPG-Key-OpenVZ










The repository contains a few different OpenVZ kernels (you can find more details about them here: http://wiki.openvz.org/Kernel_flavors). The command



[root@localhost]# yum search ovzkernel










shows you the available kernels:







[root@localhost]# yum search ovzkernel


Loading "fastestmirror" plugin


Loading mirror speeds from cached hostfile


* base: ftp.halifax.rwth-aachen.de


* openvz-kernel-rhel5: openvz.proserve.nl


* updates: ftp.halifax.rwth-aachen.de


* addons: ftp.halifax.rwth-aachen.de


* openvz-utils: openvz.proserve.nl


* extras: ftp.halifax.rwth-aachen.de


openvz-kernel-rhel5 100% |=========================| 951 B 00:00


primary.xml.gz 100% |=========================| 22 kB 00:00


openvz-ker: ################################################## 14/14


openvz-utils 100% |=========================| 951 B 00:00


primary.xml.gz 100% |=========================| 6.7 kB 00:00


openvz-uti: ################################################## 26/26


ovzkernel-ent.i686 : The Linux kernel compiled for huge mem capable machines.


ovzkernel-PAE.i686 : The Linux kernel compiled for PAE capable machines.


ovzkernel-ent-devel.i686 : Development package for building kernel modules to match the ent kernel.


ovzkernel-PAE-devel.i686 : Development package for building kernel modules to match the PAE kernel.


ovzkernel.i686 : Virtuozzo Linux kernel (the core of the Linux operating system)


ovzkernel-xen.i686 : The Linux kernel compiled for Xen VM operations


ovzkernel-xen-devel.i686 : Development package for building kernel modules to match the kernel.


ovzkernel-devel.i686 : Development package for building kernel modules to match the kernel.


[root@localhost]#










Pick one of them and install it as follows:



[root@localhost]#yum install ovzkernel-ent.i686










This should automatically update the GRUB bootloader as well. Anyway, we should open /boot/grub/menu.lst; the first kernel stanza should now contain the new OpenVZ kernel. The title of that kernel just reads "CentOS". I think it's a good idea to change that title and add something with "OpenVZ" to it so that you know that it's the OpenVZ kernel. Also make sure that the value of default is 0 so that the first kernel (the OpenVZ kernel) is booted automatically instead of the default CentOS kernel.



[root@localhost]#vi /boot/grub/menu.lst






# grub.conf generated by anaconda



#



# Note that you do not have to rerun grub after making changes to this file



# NOTICE: You have a /boot partition. This means that



# all kernel and initrd paths are relative to /boot/, eg.



# root (hd0,0)



# kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00



# initrd /initrd-version.img



#boot=/dev/sda



default=0



timeout=5



splashimage=(hd0,0)/grub/splash.xpm.gz



hiddenmenu



title CentOS OpenVZ (2.6.18-53.1.19.el5.028stab053.14)



root (hd0,0)



kernel /vmlinuz-2.6.18-53.1.19.el5.028stab053.14 ro root=/dev/VolGroup00/LogVol00



initrd /initrd-2.6.18-53.1.19.el5.028stab053.14.img



title CentOS (2.6.18-92.1.1.el5)



root (hd0,0)



kernel /vmlinuz-2.6.18-92.1.1.el5 ro root=/dev/VolGroup00/LogVol00



initrd /initrd-2.6.18-92.1.1.el5.img



title CentOS (2.6.18-92.el5)



root (hd0,0)



kernel /vmlinuz-2.6.18-92.el5 ro root=/dev/VolGroup00/LogVol00



initrd /initrd-2.6.18-92.el5.img




Note: Remember in vi editor R replaces text at cursor until esc is hit. When done editing type :wq to save file and quit











Now we install some OpenVZ user tools:



[root@localhost]#yum install vzctl vzquota










Open /etc/sysctl.conf and make sure that you have the following settings in it:



[root@localhost]#vi /etc/sysctl.conf










net.ipv4.ip_forward = 1



net.ipv4.conf.default.proxy_arp = 0



net.ipv4.conf.all.rp_filter = 1



kernel.sysrq = 1



net.ipv4.conf.default.send_redirects = 1



net.ipv4.conf.all.send_redirects = 0



net.ipv4.icmp_echo_ignore_broadcasts=1



net.ipv4.conf.default.forwarding=1











If you need to modify /etc/sysctl.conf, run afterwards



[root@localhost]#sysctl -p










The following step is important if the IP addresses of your virtual machines are from a different subnet than the host system's IP address. If you don't do this, networking will not work in the virtual machines!







Open /etc/vz/vz.conf and set NEIGHBOUR_DEVS to all:



[root@localhost]#vi /etc/vz/vz.conf










NEIGHBOUR_DEVS=all











SELinux needs to be disabled if you want to use OpenVZ. Open /etc/sysconfig/selinux and set the value of SELINUX to disabled:



[root@localhost]#vi /etc/sysconfig/selinux










Finally, reboot the system :



[root@localhost]#reboot










If your system reboots without problems, then everything is fine!







login as root and then run



[root@localhost]#uname -r










and your new OpenVZ kernel should show up:







[root@localhost]# uname -r


2.6.18-53.1.19.el5.028stab053.14


[root@localhost]#










Download CentOS 32 bit template:



[root@localhost]# cd /vz/template/cache


[root@localhost]# wget http://download.openvz.org/template/precreated/centos-5-x86.tar.gz










Create a VPS and set various limits (see vzctl man page):



[root@localhost]# vzctl create 11 --ostemplate centos-5-x86_64


[root@localhost]# vzctl set 11 --quotaugidlimit 150 --numproc 400:400 \


--kmemsize 16384000:18022400 --privvmpages 262144:292912 \


--hostname=forums.nixcraft.com --diskspace 2000000:2000000 \


--shmpages 16384:16384 --ipadd 75.126.168.152 \


--nameserver 10.0.1.11 --nameserver 10.0.1.12 --save


[root@localhost]# vzctl set 11 --onboot yes --save










Set the password for vps root user:



[root@localhost]# vzctl set 11 --userpasswd root:pass










Start VPS:



[root@localhost]# vzctl start 11










Enter into VPS:



[root@localhost]# vzctl enter 11










Now you can install additional software and configure your vps:



 yum update


yum install httpd


Link to comment
Share on other sites

cPanel Installation Instructions:



Important : You must have a valid cPanel license. If you do not have a valid cPanel license, please contact one of cPanel distributors listed at http://www.cpanel.net/dist.htm or buy a license directly from cPanel at http://www.cpanel.net/store/. cPanel now uses a universal install script which can be found at Downloads - cPanel Inc..





You can use the following commands in the root shell to download and start the installation script:





mkdir /home/cpins


cd /home/cpins


wget http://layer1.cpanel.net/latest


sh latest










At this point the installation has started and may take anywhere from 30 – 60 minutes to complete. At no point during the installation should you be prompted for user input. You will know the cPanel installation has been completed by the screen output coming to a stop & the statement “Done.” is printed on your screen. You should then hit “ctrl c”† to continue. Note: You must be on a stable connection to install cPanel. If your shell session disconnects during a cPanel install the cPanel installation will be aborted. You can restart the cPanel installation by completing “sh cpanel-*”† again, however it is recommended that you reformat your machine & start over to ensure a clean slate before placing the machine into production.



cPanel/WHM Configuration: Following a successful install you should setup cPanel/WHM as soon as possible. In order to complete this process you will need to log into your machine using its main (eth0/fxp0) IP address; you should input something similar to this into your browser:







https://xxx.xxx.xxx.xxx:2087






Note: you should replace xxx.xxx.xxx.xxx with your actual IP address. Further to that, you will be prompted about a self signed SSL certificate; ignore this by clicking on “Yes”. A self signed certificate is generated by cPanel/WHM to ensure a secure/encrypted communication with your server.







You will now be prompted with a few questions related to how you would like your installation of cPanel/WHM customized. You can walk through the wizard by clicking on “Next Step” or if you are an experienced user feel free to click on “Finish” to skip to the end.







For a complete user guide on how to access cPanel/WHM and/or use any of the functions within cPanel/WHM, please visit cPanel do*****ents section at WebHome







Just keep in mind, this is not the all-in-one package for server installaion, you’ll have to secure the server, update your kernel, install a firewall, configure SSH, apply patches …. etc,etc,etc,etc This was just to illustrate the BASIC steps to get you online.







Make sure FTP Server starts on bootup by entering:



[root@localhost]# chkconfig --level 2345 pure-ftpd on


[root@localhost]# /etc/init.d/pure-ftpd start





That should start the ftp service as well as set it to start on boot.



Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...