In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the knowledge of "how to install Red Hat Enterprise Linux AS release 4 apache+MYsql+PHP". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Software version: httpd-2.2.3.tar.gz
Mysql-5.0.18.tar.gz
Php-5.0.4.tar.gz
1 install mysql
Shell#tar xzvf mysql-5.0.15.tar.gz
# unlock the installation package
Shell#cd mysql-5.0.1
Shell#./configrue-prefix=/usr/local/mysql
Shell# make & & make install
Shell#make install
# enter the installation directory and set the installation path. Compile and install
Shell#groupadd mysql
Shell#useradd-g mysql mysql
# create a new group named mysql and a new user named mysql, and belong to the mysql group by default
Shell#chgrp-R mysql / usr/local/mysql
# change the subordinate group of / usr/local/mysql and its subordinate files and directories
Shell#cp support-files/my-large.cnf / etc/my.cnf
# copymy-large.cnf to / etc to replace the original my.cnf
Shell#scripts/mysql_install_db
# create initial data
Shell#chown-R mysql:mysql / usr/local/mysql/var
&
Shell#cp support-files/mysql.server / etc/init.d/mysqld
# copymysql.server to the init.d directory and rename it to mysqld to launch the file
Shell#chmod 755 / etc/init.d/mysqld
# set the permissions of the startup file to 755
Shell#chkconfig-add mysqld
Shell#chkconfig mysqld on
# add this service to system startup. Add is added to / etc/rc.d/init.d. On is started by default at level 3 / 5.
Shell#/etc/init.d/mysqld start
Shell#/usr/local/mysql/bin/mysqld_safe &
Start myhsql
Shell#/usr/local/mysql/bin/mysqladmin-u root password 123
The default root user password is empty and the password is set to 123
Shell#/usr/local/mysql/bin/mysql-u root-p
# after entering 123 set above. Log in as root
Shell#./mysqladmin-u root-p password 456
# change the mysql root user password to 456. Enter the original password in the prompt box
Mysql > grant select on test.* to 'ttt' @'% 'identified by'ttt' with grant option
# add a mysql account with the name ttt and password ttt, and have the permission to modify the test database
2 install apache-2.2.3
Shell#tar xzvf httpd-2.2.3.tar.gz
Shell#cd httpd-2.2.3
Shell#./configure-prefix=/usr/local/apache-enable-so
Shell#make & & make install
# unpacking setup installation information compilation and installation
Shell#cp / usr/local/apache/bin/apachectl / etc/init.d/httpd
# cp the service to the startup file
Shell#chmod 755 / etc/init.d/httpd
# set service permissions
3 install php
Shell#tar xvzf php-5.0.4.tar.gz
Shell#cd php-5.0.4
Shell#./configure-with-mysql=/usr/local/mysql-with- apxs2=/usr/local/apache/bin/apxs-prefix=/usr/local/php
Shell#make & & make instal
# unpacking setup installation information compilation and installation
Shell#echo
AddType application/x-httpd-php .php > > / usr/local/apache/conf/httpd.conf
Shell#echo AddType application/x-httpd-php .sulpx > > / usr/local/apache/conf/httpd.conf
Shell#echo AddType application/x-httpd-php-source .phps > > / usr/local/apache/conf/httpd.conf
Shell#echo DirectoryIndex index.php index.html index.htm index.html.var > > / usr/local/apache/conf/httpd.conf
# add support for php in http.conf
Shell#/usr/local/apache/bin/apachectl start
# start http
Test, create a file under / usr/local/apache/htdocs named test.php, the content is:, and then open IE and enter the native IP address to view. If the php page is displayed, the establishment is successful.
Online documentation:
# tar xzvf libpng-1.2.8-config.tar.gz
# tar xzvf freetype-2.1.9.tar.gz
# tar xzvf zlib-1.2.2.tar.gz
# tar xzvf gd-2.0.33.tar.gz
# tar xzvf httpd-2.0.54.tar.gz
# tar xzvf php-5.0.4.tar.gz
# tar xzvf mysql-5.0.15.tar.gz # default setup/change my.cnf for onlyone please
Cd mysql-5.0.18
. / configure-prefix=/usr/local/mysql-with-charset=utf8-with-extra-charsets=gbk,gb2312,big5 & & make & & make install
Groupadd mysql
Useradd-g mysql mysql
Chgrp-R mysql / usr/local/mysql
Cp support-files/my-large.cnf / etc/my.cnf
Scripts/mysql_install_db
Chown-R mysql:mysql / usr/local/mysql/var
Cp support-files/mysql.server / etc/init.d/mysqld
Chmod 755 / etc/init.d/mysqld
/ usr/local/mysql/bin/mysqld_safe &
-chkconfig-add mysqld
Chkconfig mysqld on
-
# support soft setup
Cd / root/install/libpng-1.2.8-config
. / configure & & make & & make install
Cd / root/install/freetype-2.1.9
. / configure-- prefix=/usr/local/freetype-2.1.9 & & make & & make install
Cd / root/install/zlib-1.2.2
. / configure-- prefix=/usr/local/zlib-1.2.2 & & make &; make install
Cd / root/install/jpeg-6b
Cp-R / root/install/jpeg-6b / usr/local/
Mkdir-p / usr/local/man/man1
. / configure-- enable-shared-- enable-static & & make & & make install
Cd / root/install/gd-2.0.33
. / configure-- prefix=/usr/local/gd-2.0.33-- with-freetype=/usr/local/freetype-2.1.9 & & make & & make install # apache setup
Cd / root/install/httpd-2.2.3
. / configure-prefix=/usr/local/apache-enable-so-enable-rewrite & & make & & make install
# rm-f / etc/init.d/httpd
# cp / usr/local/apache/bin/apachectl / etc/init.d/httpd
# chmod 755 / etc/init.d/httpd
# php setup
Cd / root/install/php-5.0.4
. / configure-- with-mysql=/usr/local/mysql-- enable-trans-sid-- enable-track-vars-- with-png-dir=/usr/local/bin-- with-gd=/usr/local/gd-2.0.33-- with-jpeg-dir=/usr/local/jpeg-6b-- with-extension_dir=/usr/local/lib/extension-- with-freetype-dir=/usr/local/freetype-2.1.9-- with-zlib-dir=/usr/local/zlib -1.2.2-with-apxs2=/usr/local/apache/bin/apxs-- prefix=/usr/local/php-- with-config-file-path=/usr/local/php-- enable-force-cgi-redirect-- disable-cgi-- with-gettext-- with-gdbm & & make & & make install
Sed-e 's/variables_order = "EGPCS" / variables_order = "ECPGS" / g'- e 's/register_globals = Off/register_globals = On/g' php.ini-dist > / usr/local/php/bin/php.ini
Echo AddType application/x-httpd-php .php > > / usr/local/apache/conf/httpd.conf
Echo AddType application/x-httpd-php .sulpx > > / usr/local/apache/conf/httpd.conf
Echo AddType application/x-httpd-php-source .phps > > / usr/local/apache/conf/httpd.conf
Echo DirectoryIndex index.php index.html index.htm index.html.var > > / usr/local/apache/conf/httpd.conf
/ usr/local/apache/bin/apachectl stop
/ usr/local/apache/bin/apachectl start
. / configure-- with-mysql=/usr/local/mysql-- enable-trans-sid-- enable-track-vars-- with-png-dir=/usr/local/libpng-1.2.5-- with-gd=/usr/local/gd-2.0.33-- with-jpeg-dir=/usr/local/jpeg-6b-- with-extension_dir=/usr/local/lib/extension-- with-freetype-dir=/usr/local/freetype-2.1.9-- with-zlib-dir= / usr/local/zlib-1.2.2-- with-apxs2=/usr/local/apache/bin/apxs-- prefix=/usr/local/php-- with-config-file-path=/usr/local/php-- enable-force-cgi-redirect-- disable-cgi-- with-gettext-- with-gdbm & & make & & make install [LAMP platform] the origin of the word LAMP originated from the German magazine "Cleart Magazine" Michael Kunze first combined these projects in 1990 to create the acronym for LAMP. Although these components are not designed to be used together from the beginning, these open source software are easily available at any time and for free. As a result, these components are often used together. In the past few years, the compatibility of these components has been continuously improved, and the application situation together has become very common. To improve collaboration between different components, some extension capabilities have been created. Currently, "LAMP stack" products are included by default in almost all Linux distributions. These products form a powerful Web application platform LAMP platform is composed of four components and has a hierarchical structure. Each layer provides a key part of the entire software stack: Linux:Linux is at the lowest level and provides the operating system. Every other component actually runs on Linux. However, it is not necessarily limited to Linux. If necessary, other components can also be found in Microsoft? Windows?, Mac OS X or UNIX? Run on. Apache: the next lowest layer is Apache, which is a Web server. Apache provides a mechanism for users to get Web pages. Apache is a stable, mission-critical server that is used as a Web server by more than 65% of websites on Internet. The PHP component is actually in Apache, and dynamic pages can be created through Apache and PHP. MySQL:MySQL provides the data storage side of the LAMP system. With MySQL, you can get a very powerful database suitable for running large and complex sites. In Web applications, all data, products, accounts, and other types of information are stored in this database, which can be easily queried through the SQL language. PHP:PHP is a simple and effective programming language that acts like an glue that binds together all the other components of the LAMP system. You can use PHP to write dynamic content that can access data in an MySQL database and some of the features provided by Linux. [testing tools] in order to get complete debugging results, it is recommended that you use software such as ApacheBench or httperf. If you are interested in testing servers with non-LAMP architectures, it is recommended that you use Microsoft's free software: Web Application Stress Tool (requires NT or 2000). (other server testing tools)
Check the Apache and use top d 1 to display the CPU and memory of all processes. In addition, also use the apachectl status command [hardware optimization] 1, the general rules for upgrading hardware: for PHP scripts, the main bottleneck is CPU, for static pages, the bottleneck is memory and network. The static pages downloaded by a 400 Mhz Pentium machine can saturate the T3 45Mbps. 2. Using hdparm to optimize the disk can generally improve the read and write performance of IDE disk by 200%, but it also has an effect on SCSI hard disk. (comparison of different types of hard drives) [Policy Optimization] 3. Apache processes PHP scripts 2-10 times slower than static pages, so try to use more static pages and fewer scripts. 4. If the PHP script is not buffered, each call needs to be compiled, so installing a PHP buffering product can improve performance by 25-100%. 5. If you use a Linux system, it is recommended to upgrade the kernel to 2.4, because static pages are served by the kernel. 6. Another buffering technology is to buffer the output of PHP pages that are not often modified by HTML. 7. Do not run X-Windows on the Web server, turn off processes that are not necessary. 8. If you can use text, do not use images, try to reduce the size of the picture. 9. Spread the load and put the database server on another machine. Using other low-end machine service images and HTML pages, if all static pages are processed on another server, you can set KeepAlives in httpd.conf to off to reduce disconnection time. 10. All the above methods are for stand-alone machines. If you think the system is still not fast enough, you can use clustering, load balancing and buffering technology. The method of configuring Squid by using Squid as buffer. [compiler optimization] 11. Switch a file-based session to a shared memory-based session. The-- with-mm option is used when compiling PHP, and the set session.save_handler=mm is set in php.ini. This simple modification can cut the session management time in half. 12. Use the latest version of Apache and compile PHP into it, or use DSO mode instead of CGI. 13. When compiling PHP, it is recommended to use the following parameters:
-- enable-inline-optimization-- disable-debug [configuration Optimization] 14. Modify httpd.conf:
# turn off the DNS lookups,PHP script and take only the IP address
HostnameLookups off 15. If the network is congested and the CPU resources are insufficient, use the HTML compression feature of PHP:
Output_handler = ob_gzhandler
Users of PHP 4.0.4 should not use it because of memory leaks. 16. Change the SendBufferSize in httpd.conf to the size of your largest page file. Increase the kernel's TCP/IP write buffer size. 17. When using a persistent connection to a database, don't set the MaxRequestsPerChild too large. [third-party software optimization] 18. If you like to modify the Apache source code, you can install lingerd. After the page is generated and sent, each Apache process wastes some time on the customer connection, and Lingerd can take over the job, allowing Apache to quickly serve the next customer request. 19. If you are brave enough, you can also use Silicon Graphics's Accelerated Apache patch. This project can make Apache 1.3times faster and Apache 2.0times faster. Installing a PHP buffer product can improve performance by 25-100%. [Linux system Optimization]. Clean up server disk fragmentation: no matter what file format the Linux file system uses (ext3, JFS, XFS, ReiserFS) and what type of hard disk (IDE, SCSI), the file system tends to be fragmented over time. Advanced file systems such as ext3 and JFS can reduce file system fragmentation, but not eliminate it. In busy database servers, file fragmentation will degrade hard disk performance over time, and hard disk performance can only be noticed when reading or writing data from the hard disk. Over time, you will find that there are indeed a lot of junk files accumulated on each disk, and freeing up disk space can help the system work better. The best way for Linux to defragment the disk is to make a full backup, reformat the partition, and then restore the files from the backup. However, it is difficult for 7 × 24-hour mission-critical server. Kleandisk is an efficient disk cleanup tool that divides files on disk into different "groups", such as Group all "core" files, so that when you want to delete all core files, just delete this group. Core files are files that are generated when the software is running wrong. it is useful to software developers but has no meaning to other users (such as e-mail servers). Therefore, if there is no need for software development, you can delete the core file when you see it. 2. Open the hard disk DMA the IDE hard disk currently used basically supports DMA66/100/133 (direct memory reading), but the Linux distribution is generally not opened after installation, you can add a line at the end of / etc/rc.d/rc.local: / sbin/hdparm-D1-x66-c3-M16 / dev/hda so that every time you boot, the DMA of the hard disk will be turned on, and you don't have to set it manually every time. You can use the command: hdparm-Tt / dev/hda to test and compare before and after adding. 3. Adjust buffer refresh parameters Linux kernel contains some settable parameters for the running state of the system. The parameters of the buffer refresh can be accomplished by adjusting the / proc/sys/vm/bdflush file, which is formatted as follows: # cat / proc/sys/vm/bdflush 30 64 64 256 500 3000 60 00 each column is a parameter, the most important of which are the first few parameters. The first number is to force the wake-up bdflush process to flush the hard disk when the "dirty" buffer reaches, and the second number is how many dirty blocks are flushed by the bdflush process at a time. A dirty block is a cache block that must be written to disk. The next parameter is how many memory blocks bd flush is allowed to put into the list of free buffer blocks at a time. The above value is the default value in RHEL 4.0. You can modify it in two ways: (1) use the command # echo "100128512 5000 3000 6000" > / proc/sys/vm/bdflush and add this command to the / etc/rc.d/rc.local file. (2) adding the following line to the / etc/sysctl.conf file: vm.bdflush = 100128 128512 5000 3000 6000 increases the buffer size and reduces the frequency of bdflush startup. The buffer refresh mechanism of VFS is one of the reasons for the efficiency of the Linux file system. 4. Optimizing the I / O program is also very important to the performance of the Linux system, and the network hardware is especially important to the server. Most Linux servers now use 10 Mb 100 Mb Ethernet. If there is a heavy network load, you can consider a Gigabit Ethernet card. If you do not have the ability to purchase gigabit network cards: you can use multiple network cards to become a virtual network card with the same IP address. This technology, in Linux, is called Bonding. Bonding is already included in the kernel above Linux2.4, just select Bonding driver support in the network device option at compile time as shown in figure 1. Of course, the prerequisite for using Bonding technology to configure dual network card binding is that the two network card chipsets are of the same type, and both have independent BIOS chips. Then, recompile the core, restart the computer, and execute the following command: # ismod bonding # ifconfig eth0 down # ifconfig eth2 down
# ifconfig bond0 ipaddress#ifenslave bond0 eth0#ifenslave bond0 eth2 now the two network cards are working as one. This can improve the data transmission between cluster nodes. Bandwidth is a good choice for servers. When there is no gigabit network card, using two 100 megabit network cards as bonding can greatly increase the bandwidth between the server and the switch. However, you need to set up on the switch that the two sub-ports connected to the bonding network card are mapped to the same virtual interface. Edit the / etc/modules.conf file and add the following to make the system load the Bonding module at startup. The value of alias bond0 bonding options bond0 mode=0 "mode" indicates the working mode, and there are 0, 1, 2, and 3 modes, which are set to 0 here. Bonding works in the mode of load balancing (Load Balancing (round-robin)), that is, two network cards work at the same time, and Bonding can theoretically provide twice the bandwidth. Bonding runs in Promisc mode of network cards, and it modifies the MAC addresses of two network cards to be the same. The hybrid mode is that the network card no longer receives data frames whose destination hardware address is its own MAC address, but can receive all the frames on the network. 5. Reduce the number of virtual terminals. After Linux installation, the system defaults to six virtual terminals, that is, the six CTRL+ALT F1~F6 terminals. As a server, you can turn off four of them, leaving only CTRL+ALT F1~F2, saving about 4 Mbytes of memory, but in this way, X-Window will change from CTRL+ALT F7 to CTRL+ALT F3. Modify / etc/inittab, add all mingetty 3-6 with the # font.
6. Turn off some unused services Linux server needs to start a lot of system services when starting, they provide local and network users with the system function interface of Linux, directly facing applications and users. The programs that provide these services are executed by daemons (daemons) running in the background. A daemon is a process with a long lifetime. They are independent of the control terminal and periodically perform certain tasks or wait for certain events to be processed. They often start when the system boots to load and terminate when the system shuts down. The linux system has many daemons, and most servers are implemented with daemons. Such as Web service http and so on. At the same time, the daemon completes many system tasks, such as job planning process crond, printing process lqd and so on. Some books and materials also refer to daemons as "services". See the author's article on how to turn off the service: learn more about the Linux daemon.
That's all for "how to install Red Hat Enterprise Linux AS release 4 apache+MYsql+PHP". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.