+ Reply to Thread
Results 1 to 3 of 3

Thread: Starting a Webhosting company

  1. #1
    Junior Member
    Join Date
    Jan 2012
    Posts
    22

    Starting a Webhosting company

    I`d like to open a small web hosting company , i started to dig about it on google , and i figured out that i need a fedora operating system to create a webs hosting server , i am not a linux expert , i`d like someone to illustrate to me how to install fedora and configure everything on it so i could go online. and thanks in advance.

  2. #2
    Junior Member
    Join Date
    Jan 2012
    Posts
    12
    **********
    PATR ONE : *
    *********
    I am working with fedora 9 and it is considered as the best linux operating system version so far as it is flexibile and easy
    and it is used by ISP companies , there are 2 versions of it 32Bit and 64Bit i`ll illustrate on the 32Bit version

    So , what softwares will you need ?
    - Apache 2.2.8
    - PHP 5.2.9
    - Ruby
    - MySQL 5.0.51
    - Postfix for mailing
    - BIND9
    - proftpd for FTP
    - POP3/IMAP server: Dovecot
    - Webalizer
    - cPanel

    You can download the lastest Fedora Version from HERE <http://fedoraproject.org/get-fedora> , the steps still the same.

    So before i begin , assume that i got a
    hostname : server1.example.com
    IP Address : 192.168.0.100
    Default Gateway : 192.168.1.1

    How to Install Fedora ?
    1) Download the ISO file and burn it into a DVD
    2) Put the DVD into your DVD-ROM
    3) When it boots it will give you varity of options , just choose : Install or Upgrade Existing System
    4) Installation wizard will display the HDD information just click skip
    5) Choose your language
    6) Now the Network settings page will appear , we assumed before that we got a hostname : server1.example.com
    and IP Address : 192.168.0.100 , so on Hostname click manually and put the hostname and also put your default gateway
    ip address
    7) In network devices choose your default and click Edit , click on Enable IP Support and click manual configuration
    and assign IP : 192.168.0.100 with prefix : 255.255.255.0
    8) Now choose your country
    9) Next screen it will ask you about the ROOT password , make sure it is strong and not obvious
    10) A screen will appear to create a partion of your HDD , just choose : Remove Linux partitions on selected drives and create default layout
    and a message will popup , choose : Write changes to disk
    11) A screen will appear asking you to install additional softwares , you may click on : Software Development, Web serve and fedora
    12) A screen will appear asking you again to install additional software and choose :
    -Text-based Internet
    -Development Libraries
    -Development Tools
    -DNS Name Server
    -FTP Server
    -Mail Server
    -MySQL Database
    -Server Configuration Tools
    -Web Server
    -Administration Tools
    -Base
    -Hardware Support
    -Java
    -System Tools
    13) Now wait till the installation is being finished
    14) Now when computer reboots it will ask you to add a firewall , and you may answer : Run Tool
    15) It will now ask you to use the Fedora firewall ? well , if you will install cPanel then choose Disable , otherwise choose Enabled
    16) you will now be redirected to the previous screen , just click Quit

    Now Installtion has been completed , now lets configure out server to be able to communicate over network

    1) Verify Server Network configurations :
    In terminal , write that command :
    Code:
    ifconfig
    You will notice now that the output is :
    Code:
    eth0
    Thats because this is your default communication network adapter
    2) Insure that your server is being able to communicate and communication is not blocked :
    We will disable the NetworkManager program and send these commands :
    Code:
    chkconfig NetworkManager off
    chkconfig --levels 35 network on
    /etc/init.d/network restart
    3) Do not forget the Hostname :
    Code:
    pico /etc/hosts
    Or
    Code:
    vi /etc/hosts
    Now Insure that the output is similar to that : [Output information may vary depends on your hostname and ip address input]
    Code:
    # Do not remove the following line, or various programs
    # that require network functionality will fail.
    127.0.0.1               localhost.localdomain localhost
    192.168.0.100           server1.example.com server1
    ::1             localhost6.localdomain6 localhost6
    4) Insure that the Firewall is being disabled and disabling SELinux , DO NOT follow this step unless you are installing cPanel :
    A:
    Code:
    system-config-firewall
    A popup screen will appear , just read (step 15) in the Top
    And to make sure that the firewall is successfully disabled , then write :
    Code:
    iptables -L
    You will find that the output is near to :
    Code:
    [root@server1 ~]# iptables -L
    Chain INPUT (policy ACCEPT)
    target     prot opt source               destination
     
    Chain FORWARD (policy ACCEPT)
    target     prot opt source               destination
     
    Chain OUTPUT (policy ACCEPT)
    target     prot opt source               destination
    [root@server1 ~]#
    B:
    Disabling SELinux:
    What does SELinux means and why should i disable it ?
    SELinux stands for SECURITY linux and it should be disables because you will use the cPanel Firewall
    Okay so how to disable it ?
    Code:
    pico /etc/selinux/config
    OR
    Code:
    vi /etc/selinux/config
    Now Edit the SELinux config file and set SELINUX = disabled , Like that :
    Code:
    # This file controls the state of SELinux on the system.
    # SELINUX= can take one of these three values:
    #       enforcing - SELinux security policy is enforced.
    #       permissive - SELinux prints warnings instead of enforcing.
    #       disabled - No SELinux policy is loaded.
    SELINUX=disabled
    # SELINUXTYPE= can take one of these two values:
    #       targeted - Targeted processes are protected,
    #       mls - Multi Level Security protection.
    SELINUXTYPE=targeted
    5) Now reboot the server :
    Code:
    reboot
    6) Now lets update some softwares :
    a) import GPG Keys :
    Code:
    rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*
    b) Run that command to update the Kernal :
    Code:
    yum update
    c) More important softwares to be updated like :
    fetchmail
    - wget
    - bzip2
    - unzip
    - zip
    - nmap
    - openssl
    - lynx
    - fileutils
    - ncftp
    - gcc
    - gcc-c++
    And you can update them all via that command :
    Code:
    yum install fetchmail wget bzip2 unzip zip nmap openssl lynx fileutils ncftp gcc gcc-c++
    d) Install the NANO Editor :
    Code:
    yum install nano
    7) Configurating the HDD + DNS Configurations + MySql installation :
    a) Configurating the HDD :
    Code:
    yum install quota
    After the Quota has been installed , two groups will show up : usrquota and grpquota
    They must be added to dev/VolGroup00/LogVol00 by using FSTAB , just run the command :
    Code:
    nano /etc/fstab
    OR
    Code:
    vi /etc/fstab
    And after Line one after defaults type : ,usrquota,grpquota
    It should look like that :
    Code:
    /dev/VolGroup00/LogVol00 /                       ext3    defaults,usrquota,grpquota        1 1
    UUID=03b23ff4-4dda-47a8-a23f-2f530df157b2 /boot                   ext3    defaults        1 2
    tmpfs                   /dev/shm                tmpfs   defaults        0 0
    devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
    sysfs                   /sys                    sysfs   defaults        0 0
    proc                    /proc                   proc    defaults        0 0
    /dev/VolGroup00/LogVol01 swap                    swap    defaults        0 0
    Then type these commands and hit enter :
    Code:
    touch /aquota.user /aquota.group
    chmod 600 /aquota.*
    mount -o remount /
    quotacheck -avugm
    quotaon -avug
    b) Configuring DNS :
    Code:
    yum install bind-chroot
    Wait till it finishs and give permessions to folder named
    Code:
    chmod 755 /var/named/
    chmod 775 /var/named/chroot/
    chmod 775 /var/named/chroot/var/
    chmod 775 /var/named/chroot/var/named/
    chmod 775 /var/named/chroot/var/run/
    chmod 777 /var/named/chroot/var/run/named/
    cd /var/named/chroot/var/named/
    ln -s ../../ chroot
    chkconfig --levels 235 named on
    Then start named :
    Code:
    /etc/init.d/named start
    c) Installing MySql :
    [code]yum install mysql mysql-devel mysql-server [/ode]
    After install , enable MySql :
    Code:
    chkconfig --levels 235 mysqld on
    /etc/init.d/mysqld start
    Now test the connection to MySql :
    Code:
    netstat -tap | grep mysql
    You will see that result :
    Code:
    tcp        0      0 *:mysql                     *:*                         LISTEN      2407/mysqld
    If you found it now working , then you will have to edit my.cnf
    nano /etc/my.cnf
    And then comment the line : skip-networking by adding # before it , so it looks like that :
    Code:
    [...]
    #skip-networking
    [...]
    Now restart MySql :
    Code:
    /etc/init.d/mysqld restart
    Now give MySql a root password :
    Code:
    mysqladmin -u root password 123456
    mysqladmin -h server1.example.com -u root password 123456
    I use password : 123456 , you can choose another one , and that step is very imporant and do not forget it

  3. #3
    Junior Member
    Join Date
    Jan 2012
    Posts
    12
    **********
    PART TWO *
    **********
    8) Configure server to send and recieve E-Mails :
    Code:
    yum install cyrus-sasl cyrus-sasl-devel cyrus-sasl-gssapi cyrus-sasl-md5 cyrus-sasl-plain postfix dovecot
    Now we will configure the SMTP-AUTH and TLS to be able to communicate with other mailing servers like yahoo , google and msn and so on
    Code:
    postconf -e 'smtpd_sasl_local_domain ='
    postconf -e 'smtpd_sasl_auth_enable = yes'
    postconf -e 'smtpd_sasl_security_options = noanonymous'
    postconf -e 'broken_sasl_auth_clients = yes'
    postconf -e 'smtpd_sasl_authenticated_header = yes'
    postconf -e 'smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination'
    postconf -e 'inet_interfaces = all'
    postconf -e 'mynetworks = 127.0.0.0/8'
    We have to correct the login rules to E-Mail accounts via smtpd.conf that`s to let the postfix accept the parameter : LOGIN and PLAIN :
    Code:
    nano /usr/lib/sasl2/smtpd.conf
    Then verify these values :
    Code:
    pwcheck_method: saslauthd
    mech_list: plain login
    Now we will create a SSL Certificate :
    Code:
    mkdir /etc/postfix/ssl
    Now go to the new folder we created : ssl
    Code:
    cd /etc/postfix/ssl/
    And do the following to enable SSL :
    Code:
    openssl genrsa -des3 -rand /etc/hosts -out smtpd.key 1024
    Code:
    chmod 600 smtpd.key
    openssl req -new -key smtpd.key -out smtpd.csr
    Code:
    openssl x509 -req -days 3650 -in smtpd.csr -signkey smtpd.key -out smtpd.crt
    Code:
    openssl rsa -in smtpd.key -out smtpd.key.unencrypted
    Code:
    mv -f smtpd.key.unencrypted smtpd.key
    openssl req -new -x509 -extensions v3_ca -keyout cakey.pem -out cacert.pem -days 3650
    Now configure the PostFix for the SSL to work probably :
    Code:
    postconf -e 'smtpd_tls_auth_only = no'
    postconf -e 'smtp_use_tls = yes'
    postconf -e 'smtpd_use_tls = yes'
    postconf -e 'smtp_tls_note_starttls_offer = yes'
    postconf -e 'smtpd_tls_key_file = /etc/postfix/ssl/smtpd.key'
    postconf -e 'smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.crt'
    postconf -e 'smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem'
    postconf -e 'smtpd_tls_loglevel = 1'
    postconf -e 'smtpd_tls_received_header = yes'
    postconf -e 'smtpd_tls_session_cache_timeout = 3600s'
    postconf -e 'tls_random_source = dev:/dev/urandom'
    Now add the Hostname : [Mine was server1.example.com]
    Code:
    postconf -e 'myhostname = server1.example.com'
    Now we will edit the postfix file to insure that there are no comment tags # there :
    Code:
    nano /etc/postfix/main.cf
    Verify the Output :
    Code:
    queue_directory = /var/spool/postfix
    command_directory = /usr/sbin
    daemon_directory = /usr/libexec/postfix
    data_directory = /var/lib/postfix
    mail_owner = postfix
    inet_interfaces = all
    mydestination = $myhostname, localhost.$mydomain, localhost
    unknown_local_recipient_reject_code = 550
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    debug_peer_level = 2
    debugger_command =
             PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
             ddd $daemon_directory/$process_name $process_id & sleep 5
     
    sendmail_path = /usr/sbin/sendmail.postfix
    newaliases_path = /usr/bin/newaliases.postfix
    mailq_path = /usr/bin/mailq.postfix
    setgid_group = postdrop
    html_directory = no
    manpage_directory = /usr/share/man
    sample_directory = /usr/share/doc/postfix-2.5.1/samples
    readme_directory = /usr/share/doc/postfix-2.5.1/README_FILES
    inet_protocols = all
    smtpd_sasl_local_domain =
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_security_options = noanonymous
    broken_sasl_auth_clients = yes
    smtpd_sasl_authenticated_header = yes
    smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination
    mynetworks = 127.0.0.0/8
    smtpd_tls_auth_only = no
    smtp_use_tls = yes
    smtpd_use_tls = yes
    smtp_tls_note_starttls_offer = yes
    smtpd_tls_key_file = /etc/postfix/ssl/smtpd.key
    smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.crt
    smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem
    smtpd_tls_loglevel = 1
    smtpd_tls_received_header = yes
    smtpd_tls_session_cache_timeout = 3600s
    tls_random_source = dev:/dev/urandom
    myhostname = server1.example.com
    Now lets enable the : postfix , saslauthd and Dovecot :
    Code:
    chkconfig --levels 235 sendmail off
    chkconfig --levels 235 postfix on
    chkconfig --levels 235 saslauthd on
    chkconfig --levels 235 dovecot on
    /etc/init.d/sendmail stop
    /etc/init.d/postfix start
    /etc/init.d/saslauthd start
    /etc/init.d/dovecot start
    Now let`s verify that the SMTP-AUTH and TLS are working :
    Code:
    telnet localhost 25
    If result is :
    Code:
    250-STARTTLS
    OR
    Code:
    250-AUTH PLAIN LOGIN
    Check that everything is correct by :
    Code:
    [root@server1 ssl]# telnet localhost 25
    Trying 127.0.0.1...
    Connected to localhost.
    Escape character is '^]'.
    220 server1.example.com ESMTP Postfix
    ehlo localhost
    250-server1.example.com
    250-PIPELINING
    250-SIZE 10240000
    250-VRFY
    250-ETRN
    250-STARTTLS
    250-AUTH PLAIN LOGIN
    250-AUTH=PLAIN LOGIN
    250-ENHANCEDSTATUSCODES
    250-8BITMIME
    250 DSN
    quit
    221 2.0.0 Bye
    Connection closed by foreign host.
    Now type the Following for Dovecot :
    Code:
    postconf -e 'home_mailbox = Maildir/'
    postconf -e 'mailbox_command ='
    /etc/init.d/postfix restart
    9) Enable Apache and PHP
    Code:
    yum install php php-devel php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc php-eaccelerator php-magickwand php-magpierss php-mapserver php-mbstring php-mcrypt php-mhash php-mssql php-shout php-snmp php-soap php-tidy curl curl-devel perl-libwww-perl ImageMagick libxml2 libxml2-devel
    Wait till it finishs then edit httpd.conf :
    Code:
    nano /etc/httpd/conf/httpd.conf
    Verify the output :
    Code:
    [...]
    DirectoryIndex index.html index.htm index.shtml index.cgi index.php index.php3 index.pl
    [...]
    Now enable Apache :
    Code:
    chkconfig --levels 235 httpd on
    Start Apache :
    Code:
    /etc/init.d/httpd start
    10) Enable Ruby :
    Code:
    yum install httpd-devel ruby ruby-devel
    Code:
    cd /tmp
    Code:
    wget http://www.modruby.net/archive/mod_ruby-1.2.6.tar.gz
    Code:
    tar zxvf mod_ruby-1.2.6.tar.gz
    Code:
    cd mod_ruby-1.2.6/
    Code:
    ./configure.rb --with-apr-includes=/usr/include/apr-1
    make
    make install
    Code:
    nano /etc/httpd/conf.d/ruby.conf
    Code:
    LoadModule ruby_module modules/mod_ruby.so
    Code:
    /etc/init.d/httpd restart
    11) Install FTP :
    If you are using cPanel , then i would prefer the proftpd
    So firstly remove vsftpd :
    Code:
    yum remove vsftpd
    Now install ProFTPd
    Code:
    yum install proftpd
    Run the FTP
    Code:
    chkconfig --levels 235 proftpd on
    /etc/init.d/proftpd start
    12) Install Webalizer :
    Code:
    yum install webalizer
    13) Install some Perl Modules :
    Code:
    yum -y install tcp_wrappers-devel perl tar
    Now WE ARE moving to the step where you will install cPanel :
    Code:
    mkdir /home/cpins
    Code:
    cd /home/cpins
    Code:
    wget http://layer1.cpanel.net/latest
    Wait it is 100% downloaded then
    Code:
    sh latest
    Wait some time it could take from 30 mins to 60 mins to be installed

    OKay now you have installed the cPanel and you can access it via : http://example.com:2083 http://example.com:2082
    And for WHM : http://example.com:2087 http://example.com:2086

    Finally i hope that was inofrmative for you.

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts