Build PHP + Apache + MySQL + vsftp in RedHat

Source: Internet
Author: User
Tags imap vars

Author: Dugu

I have never been quite able to install a system and set up a server or other network management work. I have never looked down on network management. I just think that installing a system is too technical to build a server. But when I was bored today and wanted to learn PHP, I found that building the original server was not an easy task (except for Windows ). It took me a day to complete the environment. As for why I need to run this command, I have to copy the file ...... Self-contempt

System Environment:

[Root @ RedHat root] #CAT/proc/version(I learned how to view the two versions on the Internet)
Linux version 2.4.20-8 (bhcompile@porky.devel.redhat.com) (GCC version 3.2.2 20030222 (Red Hat Linux 3.2.2-5) #1 Thu Mar 13 17:54:28 est 2003
[Root @ RedHat root] #CAT/etc/RedHat-release
Red Hat Linux release 9 (Shrike)

Step 1: Install vsftp (objective: file exchange between Windows and Linux. I ran RedHat in VMware)

At first, I didn't want to install the FTP server in Linux. After all, in windows, I Have A 20cn ftpserver and mini version, which is very small, win's favorite (after all, even if bt is used to transfer a small file, it will install a Serv-U ). Unfortunately, FTP is indeed downloaded in RedHat, but all files will be several hundred ~ Several K bytes, RPM signature self-check all failed, there is a way, only want to dress a Linux FTP. Ms has many options: wu-ftpd, proftpd, and so on seem to be widely used, but on Baidu, we still see a vsftp, very secure FTP, which is a favorite name. After reading the introduction, feeling better than the Serv-U function under Win. Okay, that's it!

Version: vsftpd-2.0.5.tar.gz

: Http://vsftpd.beasts.org/

1. Decompression: Tar xzvf vsftpd-2.0.5.tar.gz

2. If the source code is installed, I will put it in this directory: MV vsftpd-2.0.5/usr/local/src/

3. There is no configure here, and no compilation is required. directly: Make

4. Check whether the user nobody and FTP exist (the user directory must be in/var/ftp: useradd-D/var/FTP ), whether the directory/var/FTP,/usr/share/empty exists. If the directory does not exist, create it.

5. chown root. Root/var/FTP, and chmod og-W/var/ftp. I don't know why to set these two permissions. If you see other people's tutorials, do it first.

6. Install: make install

At this time, according to other tutorials, there are no other instructions, but I encountered an error:

Install: unable to create the general file '/usr/local/man/man8/vsftpd.8': no such file or directory
If [-x/etc/xinetd. d]; then/

My solution (create a directory that does not exist): mkdir-P/usr/local/man/man8/

7. (I did not succeed in this step. I jumped over and used different installation methods in the subsequent steps:

VI/etc/xinetd. d/vsftpd
Change disable = yes to No. Save and exit. Then service xinetd restart, OK! The newly installed vsftp is ready to work!
Note: The default vsftpd installation method is xinetd. You need to perform the preceding operations. Later, let's change it to a independently started service. )

After completing the above steps, I found that vsftpd is still not started and port 21 is not open at all. I searched the internet and it seems that the purpose of this step is to associate vsftp with the xinetd service, after xinetd is started, vsftp can be started. Because the vsftp fails, I modify it back to disable = yes)

-- Understand what the problem is. Step 7 fails because step 9 has been executed, so vsftp will not be executed in Xinetd. Delete Listen = yes in Step 9. Then change disable = yes in Step 7 to no (if vsftp is running, kill it) and Restart service xinetd restart. You can see port 21 is open!

8. Copy the configuration file to/etc: CP vsftpd. CONF/etc

9. Edit: VI/etc/vsftpd. conf. Add Listen = yes to/etc/vsftpd. conf (vsftp is not running in inetd)

10. Run/usr/local/sbin/vsftpd &

OK. You can log on to FTP 127.0.0.1 at this time, but you can only log on anonymously. to log on as a local user, make the following changes:

11. VI/etc/vsftpd. conf
Change anonmous_enable = yes to no (disable anonymous links, unsafe)
Remove the comments before local_enable = Yes (permission for enabling local user connection)
Remove the comment before write_enable = Yes (enable the write permission of the local user)
Remove the comments before local_umask = 022 (used to set the umask value for the local user to upload files. Note! If you want to specify an octal number, the first priority should be "0", otherwise it will be regarded as a 10-digit number .)

12. CP RedHat/vsftpd. PAM/etc/PAM. d/FTP (note that you cannot log on with a local user without this step !)

13. Kill the vsfptd process and re-run/usr/local/sbin/vsftpd &

Success!(Of course, the FTP installation is complete and the actual configuration is very complicated. refer to the articles in the favorites section and the link is provided later)

 

Step 2: Install MySQL (this is simple, RPM package)

Version:

MySQL-server-5.1.7-0.i386.rpm, MySQL-client-5.1.7-0.i386.rpm, MySQL-devel-5.1.7-0.i386.rpm

: Http://www.mysql.cn

1. rpm-IVH MySQL-server-5.1.7-0.i386.rpm and then start the service MySQL start (or mysqld_safe &)

2, rpm-IVH MySQL-client-5.1.7-0.i386.rpm

3, rpm-IVH MySQL-devel-5.1.7-0.i386.rpm

Finally, execute mysqladmin, mysqlshow, and so on to check if they are correct.

 

Step 3: Install Apache (this is because Apache was already installed when RedHat was first installed. I wanted to skip this step and stop installing it. Unfortunately, I encountered a problem later and had to uninstall the old version first, install the latest version:

Problems encountered when installing PHP later:

Sorry, I cannot run apxs. Possible reasons follow:

1. Perl is not installed
2. apxs was not found. Try to pass the path using -- with-apxs2 =/path/to/apxs
3. Apache was not built using -- enable-so (the apxs usage page is displayed)

At first, I thought it was an apxs problem because I confirmed that Perl had been installed. I found a bunch of articles and forums that I could not understand and found some clues:

Apxs is a tool for compiling and installing extension modules for Apache HTTP servers. It is used to compile one or more source programs or target code files as dynamic shared objects, so that the loadmodule Command provided by mod_so can be loaded to the Apache server at runtime.
Therefore, to use this extension mechanism, your platform must support the DSO feature, and Apache httpd must have built-in mod_so module. The apxs tool can automatically detect whether such conditions are met. You can also manually use this command:
$ Httpd-l

Unfortunately, even after httpd-L is executed, mod_so:
[Root @ RedHat php-5.2.2] # httpd-l
Compiled in modules:
Core. c
Prefork. c
Http_core.c
Mod_so.c

What should I do? Because I don't know how to install Apache in RedHat, I just installed it myself:

Where can I find out? There is a problem with the uninstallation:

Run: rpm-e httpd. Result:

[Root @ RedHat root] # rpm-e httpd
Error: Failed dependencies:
Httpd-Mmn = 20020628 is needed by (installed) mod_perl-1.99_07-5
Httpd-Mmn = 20020628 is needed by (installed) mod_python-3.0.1-3
Httpd-Mmn = 20020628 is needed by (installed) mod_ssl-2.0.40-21
Httpd-Mmn = 20020628 is needed by (installed) php-4.2.2-17
Libapr. so.0 is needed by (installed) mod_perl-1.99_07-5
Libaprutil. so.0 is needed by (installed) mod_perl-1.99_07-5
WebServer is needed by (installed) webalizer-2.01_10-11
Httpd> = 2.0.40 is needed by (installed) mod_perl-1.99_07-5
Httpd> = 2.0.40 is needed by (installed) mod_python-3.0.1-3
Httpd is needed by (installed) mod_ssl-2.0.40-21
Httpd is needed by (installed) redhat-config-httpd-1.0.1-18

Continue to find the information. It turns out that:

[Root @ RedHat root] # rpm-Qa | grep httpd
Httpd-manual-2.0.40-21
Httpd-2.0.40-21
Redhat-config-httpd-1.0.1-18

And unmount them one by one:

[Root @ RedHat root] # rpm-e httpd-manual-2.0.40-21

[Root @ RedHat root] # rpm-e redhat-config-httpd-1.0.1-18
Warning:/etc/alchemist/namespace/Apache/local. ADL saved as/etc/alchemist/namespace/Apache/local. ADL. rpmsave

[Root @ RedHat root] # rpm-e httpd-2.0.40-21
Error: Failed dependencies:
Httpd-Mmn = 20020628 is needed by (installed) mod_perl-1.99_07-5
Httpd-Mmn = 20020628 is needed by (installed) mod_python-3.0.1-3
Httpd-Mmn = 20020628 is needed by (installed) mod_ssl-2.0.40-21
Httpd-Mmn = 20020628 is needed by (installed) php-4.2.2-17
Libapr. so.0 is needed by (installed) mod_perl-1.99_07-5
Libaprutil. so.0 is needed by (installed) mod_perl-1.99_07-5
WebServer is needed by (installed) webalizer-2.01_10-11
Httpd> = 2.0.40 is needed by (installed) mod_perl-1.99_07-5
Httpd> = 2.0.40 is needed by (installed) mod_python-3.0.1-3
Httpd is needed by (installed) mod_ssl-2.0.40-21
Httpd is needed by (installed) redhat-config-httpd-1.0.1-18

Or is there one that hasn't been uninstalled? How? Continue to find information ...... It's so embarrassing to detach all dependent services:

[Root @ RedHat root] # rpm-e mod_perl-1.99_07-5
[Root @ RedHat root] # rpm-e mod_python-3.0.1-3
[Root @ RedHat root] # rpm-e mod_ssl-2.0.40-21
[Root @ RedHat root] # rpm-e webalizer-2.01_10-11
[Root @ RedHat root] # rpm-e httpd-2.0.40-21
Warning:/etc/httpd/CONF/httpd. conf saved as/etc/httpd/CONF/httpd. conf. rpmsave
OK. Uninstall successful.During the uninstallation process, we found that the Redhat has been installed in the PHP environment and dizzy. However, to learn how to install PHP, we also uninstalled it. The process is as follows:

[Root @ RedHat root] # rpm-Qa | grep PHP
Php-ldap-4.2.2-17
Php-imap-4.2.2-17
Php-4.2.2-17
[Root @ RedHat root] # rpm-e php-ldap-4.2.2-17
[Root @ RedHat root] # rpm-e php-imap-4.2.2-17
[Root @ RedHat root] # rpm-e php-4.2.2-17
[Root @ RedHat root] # whereis PHP
PHP:

Then reinstall Apache.

)

The preceding steps are helpless, but I learned to uninstall the RPM installation package. The value is!

Version: httpd-2.2.4.tar.gz

: Http://www.apache.org

1. Tar xzvf httpd-2.2.4.tar.gz

2. Music httpd-2.2.4/usr/local/src

3. Run CD/usr/local/src/: Configure -- prefix =/etc/httpd -- enable-module = So (in order not to execute every configure operation. /configure. You can add the current path VI/root/in the environment variable /. bash_profile, modify Path = XXXX :. (add a colon and a dot ))

4. Execute: Make

5. Run make install.

6. Start the service:/etc/httpd/bin/apachectl start. The following message is displayed: No domain name or other information. You can go to VI/etc/httpd/CONF/httpd. conf, modify servername 10.0.0.x: 80.

7. To facilitate the management of Apache in Webmin, you can: CP/etc/httpd/bin/httpd/usr/sbin/

OK. Apache installation is complete!

Step 4: Install the graphic development library (N is troublesome and tool downloading N is cumbersome)

Version: a total of five installs are required, and the sequence cannot be reversed.

Gd-2.0.33.tar.gz
Freetype-2.2.1.tar.gz
Jpegsrc.v6b.tar.gz
Libpng-1.2.12.tar.gz
Libxml2-2.6.26.tar.gz
Zlib-1.2.3.tar.gz

(Unofficial, give a collection compare full address): http://down.itlearner.com/class/Site.shtml

1. First install mongosrc.v6b.tar.gz:. Before installation, locate libjpeg. A cannot find this file. After installation, you can find this file.

(Step tar xzvf unzip src.v6b.tar.gz, MV jpeg-6b/usr/local/src/, configure, make, make install (here, you will encounter an error "cannot create a general file XXX ", mkdir-p xxx directly, and then make install), make install-Lib)

2. reinstall freetype-2.2.1.tar.gz:

(Step tar xzvf freetype-2.2.1.tar.gz, MV freetype-2.2.1/usr/local/src/, configure (here you will see the last line showing "Configure nothing to be done for 'unix '. "don't worry, execute echo $ ?, If 0 is displayed, it indicates no problem. Continue with the subsequent steps), make, make install)

3. Install zlib-1.2.3.tar.gz:

(Step tar xzvf zlib-1.2.3.tar.gz, MV zlib-1.2.3/usr/local/src/, configure, make, make install)

Install libpng-1.2.12.tar.gz on the 4th node:

(Step tar xzvf libpng-1.2.12.tar.gz, MV libpng-1.2.12/usr/local/src/, configure, you need to set CP usr/local/src/libpng-1.2.12/scripts/makefile. gcmmx makefile), make, make install)

5、this fashion gd-2.0.33.tar.gz:

(Step tar xzvf gd-2.0.33.tar.gz, MV gd-2.0.33/usr/local/src/, configure, make, make install)

Libxml2-2.6.26.tar.gz:

(Step tar xzvf libxml2-2.6.26.tar.gz, MV libxml2-2.6.26/usr/local/src/, configure, make, make install)

OK, the graphics library is complete!

Step 5: Install PHP (note that RedHat may have been installed. I have explained how to uninstall it before)

Version: php-5.2.2.tar.gz

: Http://ww.php.net

1. Tar xzvf php-5.2.2.tar.gz

2. Music php-5.2.2/usr/local/src/

3. Configure -- prefix =/usr/local/PHP -- with-apxs2 =/etc/httpd/bin/apxs -- With-Gd -- With-JPEG-dir -- With-TTF --- zlib-dir -- With-PNG-dir -- With-mysql -- enable-track-vars, at this point, the configure will end with an error: Make: *** [libphp5.la] Error 1. Solution: Execute:

Configure -- prefix =/usr/local/PHP -- with-apxs2 =/etc/httpd/bin/apxs -- With-Gd -- With-JPEG-dir -- With-TTF -- With-zlib- dir -- With-PNG-dir -- With-mysql-dir -- enable-track-vars

-DIR is added after -- With-mysql. Why? I don't know ......

4. Make)

5. Make install

6. Execute libtool -- Finish/usr/local/src/php-5.2.2.

7. chmod 755/etc/httpd/modules/libphp5.so

8. cp php. ini-Dist/usr/local/PHP/lib/PHP. ini

OK. php is installed successfully! You can go to the ETC/httpd/htdoc/directory of Apache, Vi .. /CONF/httpd. conf, configure loadmodule to see if loadmodule php5_module modules/libphp5.so exists, and add: addtype application/X-httpd-PHP. PHP, addtype application/X-httpd-PHP-source. PHPs, add directoryindex index. PHP)

Finally, create an index. php file in the htdoc directory and execute it again.

Step 6:Install Zend Optimizer

Version: ZendOptimizer-3.2.8-linux-glibc21-i386.tar.gz

: Http://www.zend.com/

1, tar xvzf ZendOptimizer-3.2.8-linux-glibc21-i386.tar.gz

2. Music ZendOptimizer-3.2.8-linux-glibc21-i386/usr/local/src/

3. Install. Sh. Enter the path as prompted.

4. Run phpinfo () to check whether the Zend version is correct.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.