时间:2021-07-01 10:21:17 帮助过:11人阅读
# rpm -qa | grep httpd
说明:检查是否安装了httpd软件包
如果有,就使用 rpm -e httpd-2.2.3-63.el5.centos --nodeps
说明:卸载软件包, --nodeps 如果有连带关系,也强制卸载
# cd /etc/httpd/
# rm -rf *
说明:到原来的apache安装目录下,将其所有的安装目录和文件都删掉
b. 卸载Mysql
# rpm -qa | grep mysql
# rpm -e mysql-5.0.77-4.el5_4.2 --nodeps
说明:卸载mysql
c. 卸载Php
# rpm -qa | grep php
# rpm -e php-common-5.1.6-27.el5 --nodeps
# rpm -e php-ldap-5.1.6-27.el5 --nodeps
# rpm -e php-cli-5.1.6-27.el5 --nodeps
# rpm -e php-5.1.6-27.el5 --nodeps
说明:卸载PHP
4、清空防火墙规则
4、关闭selinux
vi /etc/selinux/config
三、安装LAMP
1、安装zlib
tar zxvf zlib-1.2.8.tar.gz
cd zlib-1.2.8
./configure
make && make install
zlib指定安装目录可能造成libpng安装失败,故不指定,为卸载方便,建议make install执行结果输出到安装日志文件,便于日后卸载。 2、安装libxml2 wget http://xmlsoft.org/sources/old/libxml2-2.6.32.tar.gz tar zxvf libxm2-2.6.32.tar.gz
make && make install
3、安装libmcrypt
tar zxvf libmcrypt-2.5.8.tar.gzmake && make install
4.安装libpng
tar zxvf libpng-1.5.27.tar
cd libpng-1.5.27.tar
./configure --prefix=/usr/local/libpng make && make install 5、安装jpeg库 wget https://sourceforge.net/projects/libjpeg/files/libjpeg/6b/jpegsrc.v6b.tar.gz/download mkdir /usr/local/jpeg6 mkdir /usr/local/jpeg6/bin mkdir /usr/local/jpeg6/lib mkdir /usr/local/jpeg6/include mkdir -p /usr/local/jpeg6/man/man1 ./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static make && make install --enable-shared 与--enable-static参数分别为建立共享库和静态库使用的libtool 6、安装freetype 字体 tar zxvf freetype-2.6.1.tar cd freetype-2.6.1 ./configure --prefix=/usr/local/freetype make && make install 7、安装autoconf tar zxvf autoconf-2.69.tar cd autoconf-2.69 ./configure && make && make install报错提示缺少perl,使用yum -y install perl
然后在进行编译安装(下面是成功之后的)
8、安装GD库 wget https://bitbucket.org/libgd/gd-libgd/downloads/libgd-2.1.1.tar.gz tar zxvf libgd-2.1.1.tar.gz cd ibgd-2.1.1 ./configure --prefix=/usr/local/gd2/ --with-jpeg=/usr/local/jpep6/ --with-freetype=/usr/local/freetype --with-png=/usr/local/libpng make && make install9、安装cmake(mysql从5.5开始编译要用cmkae编译,所以要安装cmake)
tar zxvf cmake-2.8.12.2.tar
cd cmake-2.8.12.2
./bootstrap
gmake
gmake install
10、安装Apache
./configure --prefix=/usr/local/apache2 \
--sysconfdir=/usr/local/apache2/etc/ \
--with-included-apr \
--enable-dav \
--enable-so \
--enable-deflate=shared \
--enable-expires=shared \
--enable-rewrite=shared
make && make install
测试apache2是否安装成功
/usr/local/bin/apachetcl start 启动apache2
如果不想看见底下那一行,进入/etc/httpd.conf文件
查看80端口是否开启
# netstat -tnl|grep 80
访问Apache服务器
添加自启动
# echo "/usr/local/apache2/bin/apachectl start &>/dev/null" >> /etc/rc.d/rc.local
11、安装Mysql
1.安装ncur
yum -y install ncur* bison
2、添加mysql用户并加到mysql组中 useradd -r -s /sbin/nologin mysql mkdir -pv /usr/local/mysql/data 3.下载mysql并进行编译安装 wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.32.tar.gz tar zxvf mysql-5.6.32.tar.gz cd mysql-5.7.14 cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \-DMYSQL_DATADIR=/usr/local/mysql/data \
-DSYSCONFDIR=/usr/local/mysql/etc/my.cnf \
-DMYSQL_USER=mysql \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DMYSQL_UNIX_ADDR=/usr/local/mysql/data/mysql.sock \
-DMYSQL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DENABLED_DOWNLOADS=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_DEBUG=0 \
-DMYSQL_MAINTAINER_MODE=1 \
-DWITH_SSL:STRING=bundled \
-DWITH_ZLIB:STRING=bundled
make && make install
rm -rf /etc/my.cnf cp support-files/my-default.cnf /etc/my.cnf cp support-files/mysql.server /etc/init.d/mysqld chmod 755 /etc/init.d/mysqld chown -R mysql.mysql /usr/local/mysql/ ##初始化数据库 chmod +x scripts/mysql_install_db scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/ ln -s /usr/local/mysql/bin/* /usr/bin/ ln -s /usr/local/mysql/lib/* /usr/lib/ ln -s /usr/local/mysql/man/man1/* /usr/share/man/man1 ln -s /usr/local/mysql/man/man8/* /usr/share/man/man8 ln -s /usr/local/mysql/libexec/* /usr/local/libexec 4、启动mysql服务并加入开机自启动 service mysqld start chkconfig mysqld on 5、验证mysql服务是否启动 netstat -tulnp | grep 3306 mysql 12、安装PHP 1.安装libtool以及libtool-ltdl* wget tar zxvf cd ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/lib/mysql --enable-fpm --with-mcrypt --enable-mbstring --disable-pdo --with-curl --disable-debug --disable-rpath --enable-inline-optimization --with-bz2 --with-zlib --enable-sockets --enable-sysvem --enable-sysvshm --enable-pcntl --enable-mbregex --with-mhash --enable-zip --with-pcre-regex --with-mysql --with-mysqli --with-gd --with-jpeg-dir make && make installCentOS 6.5下源码安装LAMP(Linux+Apache+Mysql+Php)环境
标签:bootstrap prefix bst mbr admin arch isa man main