Complete Guide to setting up a web server in RedHat Linux 9.
Features : Apache / PHP / MySQL / FTP / SSH / ++
Please note : If you vi anything and the file does not exist or it is empty you should add the information into it. Several people have complained that files do not exist but all you need to do is add the info I have on the site. To be quite honest, even if the files exist and they have info in you could clean them and just use my info. This is if you are a first time user and just have to get the site up and running. How to use this guide :This guide walks you through the entire process of getting a webserver up, however it will only show you how to get a web server up and not to configure your machine for other things, you have to add those yourself. As you boot and start the install you will have to keep track of all the items needed to be installed according to the packages. The development tools is theoreticaly not needed at all for instalation however if you decide to upgrade etc you will need the compilers so it's better to get it done with fast. The guide is seperated into 2 stages the first of wich packages are needed to install and the second as to what to type to get everything working. Here is how the second stage works. Everything typed in RED is actual commands that you give the server. Everything in Blue is things you type in vi ( the text exitor ) and also stuff that should be written in the file specified. Everything in the normal orange color is information and explinations on why you do certain things.
:: = FIRST STAGE = ::
Prefered instalation type : ServerFirewall Configuration :
Allow Incomming
- WWW
- FTP
- SSH
- Allow DHCP if you need it also
Package Selection : [ Package Group Selection ]
Once you click on Editors / Web Server keep all the items under detailed enabled unless otherwise specified below. The sections without : Details means that you can just click the button to enable that section and it is all you need.
Editors > Details > Enable only vim-enhanced.
Web Server > Details > Add : mod_auth_mysql / php-mysql
FTP Server
SQL Database Server Details > Add mysql-server
Development Tools
:: = SECOND STAGE = ::
For everything after this you have to be a super user, so log in as root.
Initialize MySQL first.
/usr/bin/mysql_install_db
/etc/rc.d/init.d/mysqld start
cd /usr/bin
mysqladmin -u root password 'password'
Test MySQL now
/usr/bin/mysql -u root -penter password when asked
show databases;
It should show you the databases. [ mysql ] and [ test ]
exit
Adding a test to the website now.
cd /var/www/html
vi index.php
This will bring up a text editor, first press i (to initiate insert mode) then type the following.
<?php phpinfo(); ?>
Now hit ESC, then press :wq this will save the file and exit. If you made a mess just hit :qa! to exit
/etc/rc.d/init.d/httpd start
Now check if your website works. It should show the php info. You are nearly complete. Now to add the ability to log in and save files via FTP. SSH will already work, but the majority of people will most likely want to use FTP.
FTP Setup beginning now.
vi /etc/xinetd.d/vsftpd
The file should be
/etc/xinetd.d/vsftpd ) Nowhere else, some OS's install a pre-configured version in another directory as an example.
service ftp{
disable = no
socket_type = stream
wait = no
user = root
server = /usr/sbin/vsftpd
}
vi /etc/vsftpd/vsftpd.conf
The file should be
/etc/vsftpd/vsftpd.conf )
The following commands are not commented out or rather # character before the command for instance #anonymous_enable=NO, it should be without the # Make sure only these commands are in the file nothing more.
anonymous_enable = NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
local_root=/var/www/html
The FTP Server is now set up we just have to add a user now to log in.
groupadd www
useradd -g www -d /var/www/html ftpuser
passwd ftpuser
chown ftpuser:www /var/www/html
chmod 7777 /var/www/html
cp /etc/vsftpd/vsftpd.conf /etc/vsftpd.conf
/etc/rc.d/init.d/xinetd restart
Lets test the FTP now.
ftp localhost
Server will ask you for user and password. Use the ftpuser you just created with it's password once you are logged in do ls (LS) but lower case.
ls
You should see 2 files 1 being index.php that we created earlier, and other wich is usage that is created by the server when apache was installed. Please note that since you did all the FTP stuff as root you might get problems where your FTP won't let you copy files to a certain folders that you created as root. To fix the error just do
chmod 7777
as root on the particular folder that has the error.
You have completed the setup of your web server, for all the other info you can get via google and the websites of the products youre having problems with.
Now open a browser and see your new apache server running. It should pop up to a page with PHP Version info and a lot of garbage. This means that your PHP is working together with the apache install. This will also indicate that if you did everything I said mysql will be ready to be installed. This whole instalation is for a pretty basic website. All the other changes to httpd.conf etc you can read about on the web and ask others to help. This doc wasn't made to show how to make a production class server but merely to help the struggling new to linux user to get his / her website up quick and easy.

Latest Comments