Install PHP/Apache/MySQL/memcached in yum

Source: Internet
Author: User

I. Requirements: PHP: php5.2.6 or above, which must support the following modules: MySQL, Gd, memcached, mbstring, APC, mcrypt, curl, and FTP (where curl/FTP is installed by default) Apache: configure the PHP module. MySQL: mysql5.1.46 or above, need to support InnoDB, support partition memcached: memcached-1.4.4.tar.gz 2, background (1) New version of the home school circle server in 21 vianet machine room, so it is different from the server of our community website on the Internet. Use the Internet IP address for logon. When configuring the source code, you still use the source code in 2.14 and access it through the Internet address of 2.14. (2) How to Use centos Yum: Yum = yellow dog Updater, modified. The main function is to conveniently Add/delete/update RPM packages. It can automatically solve the dependency problem of packages and facilitate the management of a large number of system updates. Yum features: a simple configuration file (/etc/yum. conf automatically solves the dependency problems encountered when adding or deleting RPM packages. It is easy to maintain consistency with the RPM database. Yum installation: centos comes with (Yum -*. noarch. rpm) # rpm-IVH Yum -*. noarch. rpm first needs to import the system's RPM-GPG-KEY before enabling yum for the first time, this stuff is used for RPM package verification, generally can be found in the system disc. # Rpm-import/usr/share/doc/centos-release-3 (4)/RPM-GPG-KEY-CentOS-3 (4) Common commands for Yum: # Yum install XXX software # Yum info XXX view XXX software information # Yum remove XXX Delete Software Package # Yum list Software Package # Yum clean clear buffer and package # Yum provides xxx search for a package with xxx As the keyword (the provided information is the keyword) # Yum search XXX search package (name-based keyword) # Yum groupupdate XXX # Yum grouplist XXX # Yum groupremove xxx .. For example, "MySQL Database" is a group that will operate on all related software packages at the same time;) # Yum update system upgrade # Yum list available list all packages on the upgrade source; # Yum list updates lists update packages on all upgrade sources; # Yum List Installed lists installed packages; # Yun update kernel upgrade; YUM automatically selects the fastest Source: (1) the speed of some mirror in yum is very slow. If Yum chooses this mirror, yum will be very slow at this time. For this reason, you can download the fastestmirror plug-in, it automatically selects the fastest mirror: # Yum install Yum-fastestmirror configuration file: (generally do not need to change)/etc/Yum/pluginconf. d/fastestmirror. conf:/var/Cache/Yum/Time Dhosts.txt (2) for the source of China official image site: http://centos.ustc.edu.cncd/etc/yum. repos. after the DMV CentOS-Base.repo CentOS-Base.repo.bakwget http://centos.ustc.edu.cn/CentOS-Base.repo.5mv CentOS-Base.repo.5 CentOS-Base.repoyum-y update system update, if an error message is prompted during Yum installation, execute the following command to fix it. rpm-import/etc/pki/rpm-GPG/RPM-GPG-KEY * (3) for centos5 add Netease 163, Sohu Yum source first close fastestmirror "VI/etc/Yum/pluginconf. d/fastestmirror. conf "and set" enable = 0 "CD/etc/y Um. Repos. d/wget http://mirrors.163.com/.help/CentOS-Base-163.repowget http://mirrors.sohu.com/help/CentOS-Base-sohu.repoyum makecacheyum updatenow enjoy it! Iii. Installation Method Yum clean allyum-y install libevent * Yum-y install httpd * Yum-y install MySQL mysql-serveryum-y install PHP-Gd PHP-memcached PHP-mbstring PHP -mcrypt PHP-mysql PHP-apctar-zxvf memcached-1.4.4.tar.gzcd memcached-1.4.4. /configure & make install

1. Install memcached. 1) memcached is based on libevent event processing. Therefore, install the libevent library before installing memcached. Yum-y install libevent libevent-devel2) memcached compilation and installation is relatively simple, generally use the compilation and installation method is as follows: wget http://memcached.googlecode.com/files/memcached-1.4.5.tar.gztar-zxvf memcached-1.4.5.tar.gzcd memcached-1.4.5. /configuremake & make install -------------------------------------------- 2. memcached startup 1) memcached common parameters: (/usr/local/bin/memcached-H)-P <num> TCP port number to listen on (default: 11211) -U <num> UDP port number Listen on (default: 11211, 0 is off)-L <ip_addr> interface to listen on (default: inaddr_any, all addresses) -D run as a daemon-u <username> assume identity of <username> (only when run as root)-M <num> MAX memory to use for items in megabytes (default: 64 MB)-C <num> MAX simultaneous (default: 1024)-P <File> Save PID in <File>, only used with-D option-F <factor> chunk size growth fact Or (default: 1.25) 2) Start memcached/usr/local/bin/memcached-u nobody-P 11211-M 64-C 128-D ------------------------------------------ 3. memcached combines MySQL and Perl practices. Cat memcached_mysql.pl #! /Usr/bin/perl # usage: Test memcahed with MySQL and Perl # Made by yunhaozou@gmail.com, 2010/12/20 # Use cache: memcached; Use dBi; Use Data: dumper; Use Digest:: MD5 QW (md5_hex); use strict; # my $ host = "127.0.0.1"; # dB related information my $ Port = "3306"; my $ db = "zichan_db "; my $ user = "root"; my $ Password = ""; my $ DSN = "DBI: mysql: database = $ DB: Hostname = $ HOST: Port = $ port "; my $ DBH = DBI-> connect ($ DSN, $ user, $ password) or die "C Ouldn't connect to database :". DBI-> errstr; # connect dbmy $ memcached = cache: memcached-> New ({servers => ["127.0.0.1: 11211"], compress_threshold => 10_000 }); # connect to memcached # $ memcached = cache: memcached-> New ({servers => ["127.0.0.1: 11211", "192.168.2.1: 11211"], compress_threshold => 10_000 }); # indicates memcached connected to two machines, which can achieve load balancing. If one machine fails, the other can continue to use my $ zcsql = "select Sn, model, cab_no, func, intra_ip, man_addr, contact from equi Pment where Sn = '0917qar012 '; "; # my $ result = query_result ($ zcsql); print dumper $ result; $ DBH-> disconnect (); # sub query_result {my $ query_ SQL = shift; my $ query_key = md5_hex ($ query_ SQL ); # convert the query SQL statement to the MD5 value's keymy $ query_result = $ memcached-> get ($ query_key); return $ query_result if $ query_result; # $ query_result = $ DBH-> selectrow_hashref ($ query_ SQL); $ memcached-> set ("$ query_key", $ query_resul T); # When memcached has no cache, It queries data and caches memcachedreturn $ query_result;} -------------------------------------------- 4. Daily O & M 1) memcached is typical and does not consume CPU. Generally, Web processes (such as APACHE) are CPU-sensitive and memory-sensitive. Therefore, memcached can be directly run on the front-end web host and used as a data cache (or database connection pool), that is, an additional layer is added between the web program and the database. 2) Try to use memcached for distributed deployment. However, every module tries its best to implement memcached resource isolation (previously, because of the public memcached at the front-end of the Community, a page was launched for Guangdong integrated communication, and flush memcache was explicitly called due to errors in code writing by engineers, in this way, the entire memcached will be cleared for each access, and the front-end memcached resources of the entire website community will be cleared in a few seconds. In this case, the consequences will be ignored if they are serious, I don't know how miserable it is to write that code ~~) 3) use Telnet to test memcachedtelnet 127.0.0.1 11211 trying 127.0.0.1... Connected to Zou. yunhao (127.0.0.1 ). escape Character is '^]'. set Key 0 10 6 // 10 indicates that the expiration time is 10 seconds, and 6 indicates that the data to be saved is 6 bytes (here result is 6) resultstoredget keyValue Key 0 6resultend4) memcached performance view command statstelnet 127.0.0.1 11211 statsstat PID 18006 stat uptime 702 // number of seconds for memcached to run stat time 1292904537 // The Time of the current system of the host where the memcached server is located, in seconds. Stat version 1.4.5stat pointer_size 64 // pointer size of the operating system of the host where the server is located, usually 32 or 64 stat rusage_user 0.003999 stat rusage_system 0.013997 stat curr_connections 10 // indicates the number of current connections stat total_connections 11 // indicates from memcached service start to current time, total number of connections opened by the system. Stat connection_structures 11 stat cmd_get 0 // queries the cache times, average cache times per second maid/uptimestat into _set 0 // set key => value count stat into _flush 0 stat get_hits 0 // Number of cache hits, cache hit rate = get_hits/fetch _get * 100% stat get_misses 0 // cmd_get-get_hitsSTAT delete_misses 0 stat delete_hits 0 stat limit 0 stat limit 0 stat decr_misses 0 stat limit 0 stat cas_misses 0 stat cas_hits 0 stat cas_badval 0 stat auth_cmds 0 stat auth_errors 0 stat bytes_read 7 // total number of bytes read by the memcached server from the network stat bytes_written 0 // total number of bytes sent by the memcached server to the network. Stat limit_maxbytes 67108864 // maximum number of bytes allowed by the memcached service cache stat limit 1 stat limit 0 stat threads 4 stat conn_yields 0 stat bytes 0 stat curr_items 0 stat total_items 0 stat evictions 0 stat reclaimed 0end--------------------------------------------5. monitoring 1) Nagios monitoring. check_memcached first install the check_memcached plugin wget http://search.cpan.org/CPAN/authors/id/Z/ZI/ZIGOROU/Nagios-Plugins-Memcached-0.02.tar. Gztar xzvf Nagios-Plugins-Memcached-0.02.tar.gzcd Nagios-Plugins-Memcached-0.02perl makefile. PL (Other Perl modules may be required. Follow the prompts to install it through CPAN.) Make & make installcheck_memcached [-H Host: port] [-W warnings] [-C critical] [-- size-warnng] [-- size-critical] [-- hit-warning hit-Warning] [-- hit-criticalhit-critical] [-T timeout] B. /check_tcp-H host-P 11211-T 5-e-s 'stats/R/nquit/R/n '-E' uptime'-M crit2) cacti Monitors multiple memcached servers and monitors the deployment of multiple ports cacti. A. need a python memcached client apiwget ftp://ftp.tummy.com/pub/python-memcached/python-memcached-1.45.tar.gztar xzvf python-memcached-1.45.tar.gzcd python-memcached-1.45python setup. PY installb. add a template memcached multiportwget http://tag1consulting.com/blog/cacti-memcache-multi-port-templatescp memcached. PY <cacti install directory>/scripts/memcachedmultiport. pyC. when added monitoring, select "devices"> "des" & "ip"> "host template" and select "memcac ". Hedmultiport-> downed device detection select none-> SNMP Version select not in use-> create graphs-> port to query for memcached statistics fill in the memcached port. 3) You can also customize Nagios and cacti monitoring and use the memcached command stats to retrieve relevant data. This article is from chinacache. | website O & M Website: http://yunhaozou.org/mysql/233.html.download. Please keep it.

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.