Linux教程之Centos6.3编译安装LAMP
小知识:CentOS(CommunityEnterpriseOperatingSystem,中文意思是:社区企业操作系统)是Linux发行版之一。体系情况:Centos6.3X64mini
源码寄存路径:/usr/local/src
源码安装路径:/usr/local
数据库路径:/data/mysql/data
网站路径:/usr/local/apache/htdocs
――――――――――――――-后期筹办事情―――――――――――――――C
封闭防火墙和selinux
#serviceiptablesstop
#chkconfigiptablesoff
#vi/etc/selinux/config#把SELINUX=enforcing修正为disabled
保留并加入。从头启动电脑
――――――――――――――-安装入手下手―――――――――――――――――C
yum-yinstallgccgcc-c++autoconfnss_ldaplibjpeglibjpeg-devellibpnglibpng-develfreetypefreetype-devellibxml2libxml2-develzlibzlib-develglibcglibc-develglib2glib2-develbzip2bzip2-develncursesncurses-develcurlcurl-devele2fsprogse2fsprogs-develkrb5krb5-devellibidnlibidn-developensslopenssl-developenldapopenldap-developenldap-clientsopenldap-serverspcrepcre-develmakewgetvimcmakegdgd-devellibeventlibevent-develzipunzip
――――――――――――――-安装apache――――――――――――――――-
#cd/usr/local/src
#tarzvxfapr-1.4.6.tar.gz
#tarzvxfapr-util-1.5.1.tar.gz
#tarzvxfhttpd-2.4.3.tar.gz
cdapr-1.4.6
./configureCprefix=/usr/local/apr
make&&makeinstall
cd../
cdapr-util-1.5.1
./configureCprefix=/usr/local/apr-utilCwith-apr=/usr/local/apr
make&&makeinstall
cd../
cdhttpd-2.4.3
./configureCprefix=/usr/local/apacheCenable-davCenable-soCenable-maintainer-modeCwith-apr=/usr/local/aprCwith-apr-util=/usr/local/apr-util
make&&makeinstall
cd../
――――――――――――――-安装mysql――――――――――――――――-
groupaddmysql
useradd-gmysqlmysql-s/sbin/nologin
mkdir-p/data/mysql
chown-Rmysql:mysql/data/mysql
mkdir-p/usr/local/mysql
tarzxvfmysql-5.5.28.tar.gz
cdmysql-5.5.28
cmake.-DCMAKE_INSTALL_PREFIX=/usr/local/mysql-DMYSQL_DATADIR=/data/mysql/data-DSYSCONFDIR=/etc
make
makeinstall
cd/usr/local/mysql
cp./support-files/my-medium.cnf/etc/my.cnf
./scripts/mysql_install_dbCdatadir=/data/mysql/dataCuser=mysql
cp./support-files/mysql.server/etc/rc.d/init.d/mysqld
chmod755/etc/init.d/mysqld
chkconfigmysqldon
echo‘basedir=/usr/local/mysql/’>>/etc/rc.d/init.d/mysqld
echo‘datadir=/data/mysql/data/’>>/etc/rc.d/init.d/mysqld
servicemysqldstart
echo‘exportPATH=$PATH:/usr/local/mysql/bin’>>/etc/profile
ln-s/usr/local/mysql/lib/mysql/usr/local/lib64/mysql
ln-s/usr/local/mysql/include/mysql/usr/local/include/mysql
――――――――――――――-安装PHP――――――――――――――――-
cd/usr/local/src
tarzxvflibmcrypt-2.5.8.tar.gz
cdlibmcrypt-2.5.8
./configure
make&&makeinstall
/sbin/ldconfig
cdlibltdl
./configureCenable-ltdl-install
make&&makeinstall
cd../../
tarzxvfmhash-0.9.9.9.tar.gz
cdmhash-0.9.9.9/
./configure
make&&makeinstall
ln-s/usr/local/lib/libmcrypt.la/usr/lib/libmcrypt.la
ln-s/usr/local/lib/libmcrypt.so/usr/lib/libmcrypt.so
ln-s/usr/local/lib/libmcrypt.so.4/usr/lib/libmcrypt.so.4
ln-s/usr/local/lib/libmcrypt.so.4.4.8/usr/lib/libmcrypt.so.4.4.8
ln-s/usr/local/lib/libmhash.a/usr/lib/libmhash.a
ln-s/usr/local/lib/libmhash.la/usr/lib/libmhash.la
ln-s/usr/local/lib/libmhash.so/usr/lib/libmhash.so
ln-s/usr/local/lib/libmhash.so.2/usr/lib/libmhash.so.2
ln-s/usr/local/lib/libmhash.so.2.0.1/usr/lib/libmhash.so.2.0.1
ln-s/usr/local/bin/libmcrypt-config/usr/bin/libmcrypt-config
cd../
tarzxvfmcrypt-2.6.8.tar.gz
cdmcrypt-2.6.8/
/sbin/ldconfig
./configure
make&&makeinstall
cd../
tarzxvfpcre-8.31.tar.gz
cdpcre-8.31
./configureCprefix=/usr/local/pcre
make
makeinstall
cd../
tarzxvflibiconv-1.13.1.tar.gz
cdlibiconv-1.13.1/
./configureCprefix=/usr/local
make&&makeinstall
cd../
tarzxvfImageMagick.tar.gz
cdImageMagick-6.5.1-2/
./configure
make&&makeinstall
cd../
tarzxvfphp-5.3.18.tar.gz
cdphp-5.3.18/
./configureCprefix=/usr/local/phpCwith-apxs2=/usr/local/apache/bin/apxsCwith-mysql=/usr/local/mysql/Cwith-ttfCwith-xmlrpcCwith-opensslCwith-zlibCwith-freetype-dirCwith-gdCwith-jpeg-dirCwith-png-dirCwith-iconv=/usr/local/libiconvCenable-short-tagsCenable-socketsCenable-zend-multibyteCenable-soapCenable-mbstringCenable-staticCenable-gd-native-ttfCwith-curlCwith-mcrypt
make&&makeinstall
cpphp.ini-production/usr/local/php/etc/php.ini
cd../
tarzxvfPDO_MYSQL-1.0.2.tgz
cdPDO_MYSQL-1.0.2/
/usr/local/php/bin/phpize
./configureCwith-php-config=/usr/local/php/bin/php-configCwith-pdo-mysql=/usr/local/mysql
make&&makeinstall
cd../
tarzxvfimagick-2.3.0.tgz
cdimagick-2.3.0/
/usr/local/php/bin/phpize
./configureCwith-php-config=/usr/local/php/bin/php-config
make&&makeinstall
cd../
tarzxvfmemcache-3.0.6.tgz
cdmemcache-3.0.6/
/usr/local/php/bin/phpize
./configureCwith-php-config=/usr/local/php/bin/php-config
make&&makeinstall
cd../
tarjxvfeaccelerator-0.9.6.1.tar.bz2
cdeaccelerator-0.9.6.1
/usr/local/php/bin/phpize
./configure-enable-eaccelerator=sharedCwith-php-config=/usr/local/php/bin/php-config
make
makeinstall
mkdir/tmp/eaccelerator
chmod777/tmp/eaccelerator
cd../
tarzxvfZendOptimizer-3.3.9-linux-glibc23-x86_64.tar.gz
mkdir-p/usr/local/zend/
cpZendOptimizer-3.3.9-linux-glibc23-x86_64/data/5_2_x_comp/ZendOptimizer.so/usr/local/zend/
chownwww.www/usr/local/apache/htdocs/-R
chmod700/usr/local/apache/htdocs/-R
――――――――――――――-修正php.ini文件――――――――――――――――-
手工修正:查找/usr/local/php/etc/php.ini中的extension_dir=“./”
修正为extension_dir=“/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/”
并在此行后增添以下几行,然后保留:
extension=“memcache.so”
extension=“pdo_mysql.so”
extension=“imagick.so”
再查找output_buffering=Off
修正为output_buffering=On
再查找;cgi.fix_pathinfo=0
修正为cgi.fix_pathinfo=0,避免Nginx文件范例毛病剖析毛病。
3.13设置eAccelerator减速PHP:
mkdir-p/usr/local/eaccelerator_cache
vi/usr/local/php/etc/php.ini
按shift+g键跳到设置文件的最开端,加上以下设置信息:
zend_extension=”/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so”
eaccelerator.shm_size=”64″
eaccelerator.cache_dir=”/usr/local/eaccelerator_cache”
eaccelerator.enable=”1″
eaccelerator.optimizer=”1″
eaccelerator.check_mtime=”1″
eaccelerator.debug=”0″
eaccelerator.filter=”"
eaccelerator.shm_max=”0″
eaccelerator.shm_ttl=”3600″
eaccelerator.shm_prune_period=”3600″
eaccelerator.shm_only=”0″
eaccelerator.compress=”1″
eaccelerator.compress_level=”9″
zend_optimizer.optimization_level=15
zend_extension=”/usr/local/zend/ZendOptimizer.so”
/usr/local/apache/bin/apachectlrestart
小知识:退一万步讲,即使CentOS项目终结,正在运行它的企业也可以很轻松的转移到另一个企业Linux的克隆版。 了解Linux的网络安全,系统的安全,用户的安全等。安全对于每位用户,管理员来说是非常重要的。 我学习Linux的心得体会 ,希望对大家的学习有所帮助,由于水平有限,本文难免有所欠缺,望请指正。 Linux的成功就在于用最少的资源最短的时间实现了所有功能,这也是符合人类进化的,相信以后节能问题会日益突出。 清楚了解网络的基础知识,特别是在Linux下应用知识,如接入internet等等。 就这样,我们一边上OS理论课,一边上这个实验,这样挺互补的,老师讲课,一步一步地布置任务 对于英语不是很好的读者红旗 Linux、中标Linux这些中文版本比较适合。现在一些Linux网站有一些Linux版本的免费下载,这里要说的是并不适合Linux初学者。 Linux是参照Unix思想设计的,理解掌握Linux必须按照Unix思维来进行。思想性的转变比暂时性的技术提高更有用,因为他能帮助你加快学习速度。
页:
[1]