Install CentOS 5 Server with Webmin

Introduction: The goal of this how to is to show step by step instructions to setup a CentOS Server using Webmin. This demo setup is being performed on a Slicehost.com hosting account but should be straight forward to apply to any server install.  Check out my review of Slicehost here.

At the end of this tutorial you will have a CentOS server which can host your website(s) and allow you to manage all aspects of  hosting via Webmin web GUI interface (instead of something like CPanel or H-Sphere).

Using Webmin you can manage everything needed in a web server like Apache, dns-server, php 5, mysql database, email using Postfix Server, FTP server etc.

Webmin is Free alternative to cPanel.

All recent versions of Webmin are under a BSD-like license, meaning that it may be freely distributed and modified for commercial and non-commercial use.


Ok, to begin with the actual install of the CentOS 5.2 build, using Slicehost is literally a 3 click install.

Login to your Slicehost account
Select Your Slice Name that was assigned on registration
1) Click on REBUILD link
2) Select from a drop down list of Linux Flavors (CentOS 5.2, Debian, Ubuntu and Others)
3) Submit ‘rebuild’

Wolla, in less then 5 min you will have the selected version installed and an email sent from Slicehost with login details for your brand you linux server install.

Alternately, you can download the iso version from here and install CentOS 5
http://centos.org/modules/tinycontent/index.php?id=15

Chapter 1: CentOS Server Install – Some prep work

Before we get started there are couple of items we want to take care of.

First thing you want to be sure before we get started on setting up centos server installation is to find out what processor the machine is using.  If you own the PC than you probably already now, but if you are installing on a hosted machine you will want to check this.

At the command line, type the following

# $ uname –a

Output:

Linux servername 2.6.18-xen #1 SMP Tue Feb 12 06:40:50 UTC 2008 x86_64 x86_64 x86_64 GNU/Linux

this shows the server name, Linux kernel and the x86_64 (meaning a 64 bit processor)
32bit processors include: i386/i486/i586/i686
64bit processor will show: x86_64

Why is this Important?

As you start to install and manage your CentOS installation, you will find that you need this information to pick the right software distributions that work with your server processor.

Chapter 2: Install Webmin

Sat, 06/14/2008 – 06:21 |  admin

Login to the server and become root user to install Webmin.

Its a good practice to NOT use your ‘root’ user for your server management.
Instead create another user and make it ‘sudo root’ when you need root level privileges.

The steps below create a new user and this new user then becomes ‘su root’ when needed.

xyz 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@xyz ~]# adduser secondrootuser

[root@xyz ~]# passwd secondrootuser

Changing password for user secondrootuser.

New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

[root@xyz ~]#

[root@xyz ~]#exit

NOW log back in as su user
xyz login: secondrootuser

Password:

[secondrootuser@xyz ~]$su root
Password:

Install Webmin

Download Webmin, key and yum install.
in the commands below I have 2 files downloaded on the local server.

wget http://prdownloads.sourceforge.net/webadmin/webmin-1.410-1.noarch.rpm

rpm –import http://www.webmin.com/jcameron-key.asc

yum localinstall webmin-1.410-1.noarch.rpm

—this should download and install perl (dependent package) and webmin – give it a few minutes as it will take maybe 3-5 min

It should look  something like this.

Downloading Packages:

(1/1): perl-5.8.8-10.el5_ 100% |=========================|  12 MB    00:05

Running Transaction Test

Finished Transaction Test

Transaction Test Succeeded

Running Transaction

Installing: perl                         ######################### [1/2]

Operating system is CentOS Linux

Installing: webmin                       ######################### [2/2]

Webmin install complete. You can now login to http://xyz:10000/

as root with your root password.

Installed: webmin.noarch 0:1.410-1

Dependency Installed: perl.x86_64 4:5.8.8-10.el5_0.2

Complete!

[root@xyz /]#

Chapter 3: Webmin Login

Now that Webmin is installed you can access the Webmin interface via the browser to access your CentOS Server.

If this is installed on your local machine, then the web address for Webmin login is

http://localhost:10000/

or

http//192.168.0.1:10000/

basically its the local IP for your machine and port 10000.

If you have installed this on a remote server or if you have an IP assigned to your server then

http://ip.add.re.ss:10000/

This should bring you to the login page

username: root
password: your current root password

Once logged in you should see this Webmin home page.

webmin_home

——— 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
#/etc/webmin/start

using your sudo root
#sudo /etc/webmin/start

you can also restart webmin by
#sudo /etc/webmin/restart


Set Webmin to Auto Start on Server Startup.

#chkconfig –level 23 webmin on
#chkconfig –list webmin

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

#yum -y install chkconfig

Chapter 4: BIND DNS Server Installation and Initial Configuration

Installing BIND DNS Server from ssh shell is the best option, even though Webmin gives the ability to install it from the web interface.

Yum has a BIND rpm that installs bind in a much more secure manner using a strategy called BIND CHROOT Jail.   Obviously a secure method is much more preferable especially when you are talking about how a domain name is to be routed.

Before we do the Yum install of BIND CHROOT jail, lets look at it from Webmin first as we will come back to Webmin for BIND configurations once its installed.

Servers > BIND DNS Server

Chapter 5: Install MySQL 5.0 Database via Webmin

Install of MySQL Database Server is quite simple via the Webmin interface.

Initially you will find the MySQL Sever module in the ‘unused modules’ in Webmin.

Webmin > unused modules > MySQL database server

webmin_mysql_server_install

Click on the link to download the packing using Yum.

webmin_mysql_server_install webmin_mysql_server_install

Thats about it for MySQL 5.0 install, in the next section we will just do minor changes to our database.

If installing from command line install following:

#sudo yum install mysql mysql-devel mysql-server

IMPORTANT: In order for you make php queries to the newly installed MySQL database server, we need to install PHP-MYSQL connector script, please see Chapter 6 on PHP install of this tutorial.

Chapter 6: Install PHP 5

Installation of PHP 5 via command line.
Reason I prefer command line interface here is because of many functions do not work properly when done via a browser interface. Like from the Webmin Command line.

On the other hand the Slicehost.com browser based command console can be used without any issues as shown throughout this tutorial.

#yum install php php-devel php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc curl curl-devel perl-libwww-perl ImageMagick libxml2 libxml2-devel

The above command is installing quite a few packages and the related dependencies will be downloaded automatically.

—I got 166 packages that need to be installed.

Accept install: y

That’s pretty much it for PHP install and for it to work with most popular database MySQL.
(The package ‘php-mysql’ in the above command line is the connector for php-MySQL.  This is what makes php communicate with the MySQL database.)

One setting that MIGHT need to be enabled in php.ini to accept global variables.  It’s a security issue but some old codes out there might not work if not turned on.

Chapter 7: Webmin SSL Setup

Fri, 07/11/2008 – 03:51 |  admin

In order to access Webmin via a secure SSL connection, first we need to install some modules.

Webmin > Other > Perl Modules > recommended tab > Net::SSLeay

webmin_perl_modules_ssleay webmin_perl_modules_ssleay_install

Now we need to enable SSL in Webmin.

Webmin Config > SSL Encryption = yes.

webmin_enable_ssl

We are now ready to connect to Webmin on https://ip:10000

Chapter 8: Install Cyrus-sasl and OpenSSL

OpenSSL and Cyrus-sasl along with other security modules are needed to install our email server and also needed for SSL setup for secure pages of your website.

Install the following modules from the command line.

# yum install cyrus-sasl-devel cyrus-sasl-gssapi cyrus-sasl-md5 cyrus-sasl-plain
—————–
# yum -y update
Note: above command will ‘update’ all your modules using yum update feature.

OR

You can install each cyrus module from Webmin > Software Packages > Yum search

webmin-software-package-search
webmin_cyrus-sasl webmin_cyrus-sasl-gssapi webmin_cyrus-sasl-md5 webmin_cyrus-sasl-plain

In this section we will install the openssl module along with some other modules that are needed and generate our certificates.

Enter these from your command line

# yum install openssl fetchmail wget bzip2 unzip zip nmap lynx fileutils gcc gcc-c++

Chapter 9: Install and Configure Postfix Mail Server

First from Webmin install the Postfix Mail Server module.

Webmin > Servers > Postfix Mail Server

Now, to configure SMTP-AUTH and TLS:

(you should be logged in as root. If using ssh login as su gives bash: postconf not found .
TRY su –  )

#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_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination’

#postconf -e ‘inet_interfaces = all’
#postconf -e ‘mynetworks = 127.0.0.0/8’

I just copy and paste each of the above lines in the command shell module of Webmin logged in as root.


Next we must edit /usr/lib/sasl2/smtpd.conf so that Postfix allows PLAIN and LOGIN logins.

On a 64Bit Centos 5.0 you must edit the file /usr/lib64/sasl2/smtpd.conf instead.
It can search for this file using webmin file manager search.
Webmin -> file manager > FIND icon > file name row > smtpd.conf > search
– double click, then edit:

pwcheck_method: saslauthd
mech_list: plain login

Chapter 10: Install Dovecot IMAP/POP3 Server

In the previous section we installed a Postfix Mail Server, now in order to retrieve your email to say into your Outlook we need to install a POP3 server.

Initially you will find the Dovecot IMAP POP3 email client in the unused module section of Webmin.

Webmin > Un-used Modules > Dovecot IMAP/POP3 Server

dovecot-imap-server-install dovecot-imap-server-installed dovecot-imap-server-installed2

Now that the IMAP POP3 email server is installed we need to configure it.

By default, CentOS’ Dovecot daemon provides only IMAP and IMAPs services. Because we also want POP3 and POP3s we must configure Dovecot to do so.
We edit /etc/dovecot.conf and enable the lines (remove #)

From command line use the vi command to edit a file.

vi /etc/dovecot.conf

Ensure you have the following in the ‘edit config file’ of dovecot.

# Required on x86_64 kernels
login_process_size = 64

protocols = imap imaps pop3 pop3s
listen = *
ssl_listen = *
ssl_disable = yes
mail_location = maildir:~/Maildir
ssl_cert_file = /etc/postfix/ssl/smtpd.crt
ssl_key_file = /etc/postfix/ssl/smtpd.key

protocol imap {
imap_client_workarounds = outlook-idle delay-newmail
listen = 127.0.0.1:10143
}

protocol pop3 {
pop3_uidl_format = %08Xu%08Xv
pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
}

protocol lda {
postmaster_address = postmaster@example.com
}

auth default {
mechanisms = plain login
passdb pam {
}
userdb passwd {
}
#  user = root
socket listen {
client {
path = /var/spool/postfix/private/auth
mode = 0660
user = postfix
group = postfix
}
}
}

dict {
#quota = mysql:/etc/dovecot-dict-quota.conf
}

plugin {
}

Thats about it for the IMAP/POP3 server install.

Now if you follow the instructions for email account setup in say Outlook you should be able to connect to your mail server using the pop3 mail setting.


Note: You can create a new email account after you have installed Virtualmin to manage your domains.

Webmin > Virtualmin Virtual Server > Select domain name > Edit Mail Aliases > Add an alias to this domain.

Chapter 11: Testing Your Postfix/Dovecot Mail Server

Now that we have configured your Postfix Mail Server and your Dovecot POP3 server, we can test to see if everything is working ok.

Again for command line entires, I suggest you NOT use Webmin’s command line interface which being browser based caused issues with dependency checks and most of the time will not work properly.

First lets make sure that we have these services set to start on boot up.

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

postfix-bootup

Above you see sendmail errors as there is no sendmail installed on the system.

Here is good website to check if there are any holes in your smtp setup:
http://www.test-smtp.com/

Chapter 12: Install Virtualmin

Virtualmin allows you to host multiple domains on your CentOs 5 server (or any linux flavor supported by webmin – check out the list of supported distributions here).

You can also find more info at their website: http://webmin.com/vinstall.html

Get the link for the download and paste in Webmin > Software Packages > http line

or

Download the file: wbm-virtual-server-3.55.gpl-1.noarch.rpm or the current latest version to your local pc and then upload to your remote server.

Then from ssh shell, go to the directory where you uploaded the file and install.

#yum localinstall wbm-virtual-server-3.55.gpl-1.noarch.rpm

See the images below to install via the Webmin http line.
Once installed ‘refresh’ Webmin modules.

virtualmin-install virtualmin-install2 webmin-refresh-modules

Checking Virtualmin Install

Webmin > Servers > Virtualmin Virtual Servers > Re-check and refresh configuration

virtualmin-virtual-servers If you see this Postfix Virtual map error
see next page.
virtualmin-postfix-error
Explore posts in the same categories: centos, webadmin, webmaster

6 Komentar pada “Install CentOS 5 Server with Webmin”

  1. SEO Project Says:

    Your Step by step deatil is really informative and easy to understand…

    Thank You
    __________
    Daniel

    SEO Project


  2. We absolutely love your blog and find most of your post’s to be just what I’m
    looking for. Would you offer guest writers to write content for you?

    I wouldn’t mind publishing a post or elaborating on some of the subjects you write about here. Again, awesome website!


  3. They are directly affiliated with the company and use managerial accounting, which includes in-depth reports used to determine financial strengths and weaknesses.

    Managers that are aware of this simplified budgeting method might
    fear that they could receive future funds that are smaller
    than the expected growth rate and therefore feel motivated
    to use up the assigned budget. You should reconcile
    your accounts on everyday basis and do not store it up.


  4. META tags are pieces of HTML code which some search engines use in evaluating the content of a website.
    So if you want your business to grow faster so it is important to have
    a strong online presence, and the best way to see the web is via
    Cheap SEO Services in Melbourne. It includes performance of advanced concepts to extend the rank of a specific website in
    search.

  5. Clarice Says:

    Your energy levels have a lot to do with what you eat. Current research at Appalachian State
    University is focusing on the role of chia seeds on artery health.
    Because he was still quite small the doctors recommended he eat a lot of protein, particularly red meat.


  6. A person meet a person and you just fall in love and that’s this. Not only these quotes inspire ordinary mortals to lead from the front, but also keep them in good stead when their leadership skills are tested in real time scenario. – Eleanor Roosevelt (American United Nations Diplomat, Humanitarian and First Lady).


Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s


%d blogger menyukai ini: