Jump to content

Install Apache


shadowmac
 Share

Recommended Posts

APACHE WEB SERVER


Apache Web Server is already installed and you can confirm it's installed by going to Webmin (https://youripaddress:10000)



Login (probably with root)




MYSQL DATABASE SERVER


Again, another easy task using Webmin. Once you log into webmin as discussed previously, click on


Un-used Modules - MySQL Database Server and click on the link that will install using Yum



Once finished installing MySql Database Server you will be prompted with a link at the bottom of the screen that states something like Return to MySQL Database Server. Click the link to continue.


Click on Start MySQL Server which runs the command /etc/rc.d/init.d/mysqld start



Once MySQL starts successfully, you will now see the management screen for MySQL. If not, while in Webmin, click on Servers then click on MySQL Database Server.


Click on MySQL System Variables and search for ‘port’ and you'll find the port number that MySQL is using. Typically 3306



Now that the MySQL database server is installed we just need to 'start' the server and then make sure that we configure it to 'autostart' when system is rebooted for any reason.



Run the following commands from shell access


# chkconfig --level 23 mysqld on

# chkconfig --list mysqld



NOTE: the 2 and 3 are Unix run level settings

  • rc2.d - Single User Mode with Networking

  • rc3.d - Multi-User Mode - boot up in text mode






Set MySQL Admin password

mysqladmin -u root password yourrootsqlpassword

mysqladmin -h server1.example.com -u root password yourrootsqlpassword



PHP

Run the following commands from shell access to install PHP 5

#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



OR

rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt

cd /tmp

wget http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm

rpm -ivh rpmforge-release-0.3.6-1.el5.rf.i386.rpm

yum install ntp httpd mysql-server php php-mysql php-mbstring php-mcrypt phpmyadmin rpm-build gcc mysql-devel openssl-devel cyrus-sasl-devel pkgconfig zlib-devel pcre-devel openldap-devel postgresql-devel expect libtool-ltdl-devel openldap-servers libtool gdbm-devel pam-devel gamin-devel



NOTE: If you receive YUM errors, its more then likely because of mysqld and memory (especially if you are in a VPS). easiest way to solve this is to stop mysqld service.



Now we configure phpMyAdmin. We change the Apache configuration so that phpMyAdmin allows connections not just from localhost (by commenting out the stanza):

vi /etc/httpd/conf.d/phpmyadmin.conf



#

# Web application to manage MySQL

#



#

# Order Deny,Allow

# Deny from all

# Allow from 127.0.0.1

#



Alias /phpmyadmin /usr/share/phpmyadmin

Alias /phpMyAdmin /usr/share/phpmyadmin

Alias /mysqladmin /usr/share/phpmyadmin




Next we change the authentication in phpMyAdmin from cookie to http:

vi /usr/share/phpmyadmin/config.inc.php





/* Authentication type */

$cfg['Servers'][$i]['auth_type'] = 'http';





Then we create the system startup links for Apache and start it:

chkconfig --levels 235 httpd on

/etc/init.d/httpd start





Now you can direct your browser to http://youripaddress/phpmyadmin/ or and log in with the user name root and your new root MySQL password.



To install amavisd-new, spamassassin and clamav, run the following command:



yum install amavisd-new spamassassin clamav clamd unzip bzip2 unrar perl-DBD-mysql



Then we start freshclam, amavisd, and clamd...



chkconfig --levels 235 amavisd on

chkconfig --levels 235 clamd on

/usr/bin/freshclam

/etc/init.d/amavisd start

/etc/init.d/clamd start



... and create some necessary directories:



mkdir /var/run/amavisd /var/spool/amavisd /var/spool/amavisd/tmp /var/spool/amavisd/db

chown amavis /var/run/amavisd /var/spool/amavisd /var/spool/amavisd/tmp /var/spool/amavisd/db



ISPConfig 3 allows you to use mod_php, mod_fcgi/PHP5, cgi/PHP5, and suPHP on a per website basis.



mod_fcgid is not available in the official CentOS repositories, but there's a package for CentOS 5.x in the centos.karan.org testing repository. We enable the repository as follows:



cd /etc/yum.repos.d/

wget http://centos.karan.org/kbsingh-CentOS-Extras.repo



Next we open /etc/yum.repos.d/kbsingh-CentOS-Extras.repo...



vi /etc/yum.repos.d/kbsingh-CentOS-Extras.repo



... and set gpgcheck to 0 and enabled to 1 in the section:





name=CentOS.Karan.Org-EL$releasever - Testing

gpgcheck=0

gpgkey=http://centos.karan.org/RPM-GPG-KEY-karan.org.txt

enabled=1

baseurl=http://centos.karan.org/el$releasever/extras/testing/$basearch/RPMS/





yum install php php-devel php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc php-eaccelerator php-mbstring php-mcrypt php-mhash php-mssql php-snmp php-soap php-tidy curl curl-devel perl-libwww-perl ImageMagick libxml2 libxml2-devel mod_fcgid php-cli httpd-devel



Next we open /etc/php.ini...



vi /etc/php.ini



... and change the error reporting (so that notices aren't shown any longer) and add cgi.fix_pathinfo = 1 at the end of the file:



;error_reporting = E_ALL

error_reporting = E_ALL & ~E_NOTICE



cgi.fix_pathinfo = 1




Next we install suPHP:



cd /tmp

wget http://suphp.org/download/suphp-0.7.1.tar.gz

tar xvfz suphp-0.7.1.tar.gz

cd suphp-0.7.1/

./configure --prefix=/usr --sysconfdir=/etc --with-apr=/usr/bin/apr-1-config --with-apxs=/usr/sbin/apxs --with-apache-user=apache --with-setid-mode=owner --with-php=/usr/bin/php-cgi --with-logfile=/var/log/httpd/suphp_log --enable-SUPHP_USE_USERGROUP=yes

make

make install



Then we add the suPHP module to our Apache configuration...



vi /etc/httpd/conf.d/suphp.conf



LoadModule suphp_module modules/mod_suphp.so




... and create the file /etc/suphp.conf as follows:

vi /etc/suphp.conf





;Path to logfile

logfile=/var/log/httpd/suphp.log



;Loglevel

loglevel=info



;User Apache is running as

webserver_user=apache



;Path all scripts have to be in

docroot=/



;Path to chroot() to before executing script

;chroot=/mychroot



; Security options

allow_file_group_writeable=true

allow_file_others_writeable=false

allow_directory_group_writeable=true

allow_directory_others_writeable=false



;Check wheter script is within DOCUMENT_ROOT

check_vhost_docroot=true



;Send minor error messages to browser

errors_to_browser=false



;PATH environment variable

env_path=/bin:/usr/bin



;Umask to set, specify in octal notation

umask=0077



; Minimum UID

min_uid=100



; Minimum GID

min_gid=100





;Handler for php-scripts

x-httpd-suphp="php:/usr/bin/php-cgi"



;Handler for CGI-scripts

x-suphp-cgi="execute:!self"




Finally we restart Apache:

/etc/init.d/httpd restart





PureFTPd can be installed with the following command:

yum install pure-ftpd





Then create the system startup links and start PureFTPd:

chkconfig --levels 235 pure-ftpd on

/etc/init.d/pure-ftpd start





JOOMLA 1.5


Link to comment
Share on other sites

  • 1 year later...

Your server has a single IP address, and multiple aliases (CNAMES) point to this machine in DNS. You want to run a web server for www.example1.com and www.example2.org on this machine.



Creating virtual host configurations on your Apache server does not magically cause DNS entries to be created for those host names. You must have the names in DNS, resolving to your IP address, or nobody else will be able to see your web site. You can put entries in your hosts file for local testing, but that will work only from the machine with those hosts entries.







# Ensure that Apache listens on port 80


Listen 80



# Listen for virtual host requests on all IP addresses


NameVirtualHost *:80






DocumentRoot /www/example1


ServerName www.example1.com



# Other directives here










DocumentRoot /www/example2


ServerName www.example2.org



# Other directives here







The asterisks match all addresses, so the main server serves no requests. Due to the fact that www.example1.com is first in the configuration file, it has the highest priority and can be seen as the default or primary server. That means that if a request is received that does not match one of the specified ServerName directives, it will be served by this first VirtualHost.



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...