A Guide To Installing A Red Hat Linux Server Page 1

A Guide To Installing A Red Hat Linux Server Page 1
Page content

Introduction

In this article I am going to go through how to get a basic server up and running in Red Hat Linux Enterprise. By the end you should have a server which serves web pages, does server-side calculations, has a database, does some simple file transfer and email.

Red Hat also has a desktop environment to match the corporate server, which is useful if you will be accessing the server as a team or on a LAN. If it is just a simple server, you should be fine with moderate hardware and will not need a desktop environment. If you are planning to run virtual machines, high-traffic websites or game servers then you will need a more powerful server.

SSH

SSH stands for Secure SHell and is especially useful for remote administration, but can also be used to upload files and for backup utilities. On an RHEL install it should be installed and running by default, if you would like to check you can run: /etc/init.d/sshd start

You can now access your server from elsewhere, depending on your routers firewall if you are behind one. You need to know the IP of the computer to SSH into it, run ifconfig -a if you do not know it. You should now be able to access the computer through SSH.

LAMP

LAMP consists of your basic Linux+Apache+MySQL+PHP setup, this is the backbone for any web server and using this you can run a variety of applications such as your own Wordpress site. First you need to get the httpd program, you can get this by typing: yum install httpd as root. You also need PHP, which is a server side programming language and allows your web pages to interact with the database. While others can be used, PHP is often recommended for a Linux web server as it is open source and was designed for use on a Linux system.

Finally, you need the MySQL program, which allows you to have databases on the system. You can get this by running yum install mysql-server mysql, again as root. MySQL is also open source, and PHP includes functions to make use of a MySQL database out of the box.

if all went well, you should now be able to start both the web server and the database server with the following commands: service httpd start and service mysql start.

FTP

SSH can be used for secure file transfers, but if you intend to house some files or have a lot of people with storage space, FTP is certainly the easiest to use. In order to make use of FTP you need an FTP daemon, the one usually used in RHEL is VSFTPD, and you can install it using yum install vsftpd.

Your FTP server is now active and an anonymous account will be set up to use /var/ftp. You may want to configure it to have more users or a more secure setup. In order to do this you can edit /etc/vsftpd.conf and use the official manual to make your changes. Make sure you back the original file up in case you make a mistake, to do that just run: cp /etc/vsftpd.conf /etc/vsftpd.conf.bckup

While VSFTPD is the most popular, there are many other FTP daemons that you can use, and some are easier to setup and configure.

DNS

If you are interesting in hosting web sites with different web addresses on your server there are two ways to go about it, you can pay for an external DNS provider or you can add a DNS service to your server. Since we already have a server, I would always set up the service and just use what I have. However it does have a steep learning curve if you have never used it before.

A DNS server is used for the Domain Name System. A web address will point to your server and the DNS service is responsible for what happens next and where it goes. The most popular DNS software for Linux is bind9, which can be installed in yum: yum install bind9

Once it is installed you can configure it in the /var/named folder. The official guide for configuring is difficult to follow, especially for someone new to the DNS system, but there are more human friendly guides out there.

Email

In order to set up and configure email on our new RHEL server we need two services, one for outgoing mail and one for incoming. This can be achieved with two programs known as postfix and dovecot, we will start by installing the software required: yum install postfix dovecot system-switch-mail system-switch-mail-gnome

Postfix is used for incoming mail, and delivers it to the correct user of the system. You can configure it using /etc/postfix/main.cf, you should then add/edit/uncomment the following lines (replacing example.com with your own domain):

-—————————————————————————————–

myhostname = mail.example.com

mydomain = example.com

myorigin = $mydomain

inet_interfaces = all

mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

mynetworks = 192.168.0.0/24, 127.0.0.0/8

relay_domains = home_mailbox = Maildir/

-—————————————————————————————-

Email Part Two

Incoming main should now be configured correctly, we just need to configure outgoing mail. In order to do that you must edit /etc/dovecot.conf and make sure that the following are under “protocols”: imap, imaps, pop3, pop3s and that the mail location is ~/Maildir.

Once you can confirmed or added these values, you need to create the mailbox folder in each users home directory and give the user ownership and the correct permissions of 700. Now you are ready to start the email services, run system-switch-mail first and select postfix as your MTA. (Mail Transfer Agent.) then run: chkconfig –level 345 dovecot on to make dovecot start automatically. Finally you can start both services with: /etc/init.d/dovecot start and /etc/init.d/postfix start.

Email should now be up and running, you can test it by emailing a user on the system and checking the users “Maildir” folder. You might want to set a web based solution up for viewing email.

Firewall

In RHEL the firewall is automatically set up to block all incoming traffic. You may want to confirm this by running iptables -L and checking the “incoming chains” section. You will want to unblock a certain number of ports for different services. Port 21 for FTP, 22 for SSH, 25 for postfix, 53 for DNS, 80 and 443 for LAMP, and finally 143 for dovecot.

The safest way to allow those services is to leave the “block all” on and configure a few new rules to allow certain ports and services. If you are not familiar with iptables then you can read this article to help you configure it correctly.

Conclusion

There are many more services that you can run on your RHEL server that do various tasks, but this guide should allow you to set up a basic server with some basic services. If you are setting email up it is highly recommended that you have a domain name associated with your server, and it is set as your hostname.

To set a domain as your hostname you need to edit the hostname entry in /etc/sysconfig/network, and change /etc/hosts to suit. Once you have done that you can run /bin/hostname {new host} to make it take effect without a reboot.

Thank you for reading and if you have any troubles setting these services up please feel free to leave a comment below and I will get back to you with a proposed solution.