用编译部署lamp架构

  • A+
所属分类:资源分享

准备工作:lamp.zip
yum groupinstall "Development Tools" -y
mkdir -pv /usr/local/src/lamp
tar -xvf lamp.tar -C /usr/local/src/lamp/
cd /usr/local/src/lamp/
一、安装apr
tar fvxj apr-1.4.6.tar.bz2
cd apr-1.4.6/
./configure --prefix=/usr/local/apr
make && make install
二、安装apr-util
tar fvxj apr-util-1.5.1.tar.bz2
cd apr-util-1.5.1/
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/
make && make install
三、安装Apache
停掉Apache服务:service httpd stop
1)yum install zlib-devel openssl-devel pcre-devel -y
2)tar fvxz httpd-2.4.3.tar.gz
3)cd httpd-2.4.3/
4)./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --enable-module=so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared --enable-cache --enable-file-cache --enable-mem-cache --enable-disk-cache --enable-static-support --enable-static-ab --disable-userdir --with-mpm=prefork --enable-nonportable-atomics --disable-ipv6 --with-sendfile
5)make && make install
/usr/local/apache2/bin/apachectl -k start //开始Apache服务
ps -aux | grep apache //查看Apache运行
killall httpd //关闭Apache服务
四、安装Mysql
1)rpm -ivh cmake-2.6.4-7.el5.i386.rpm
2)groupadd mysql //添加组
useradd -g mysql mysql //添加用户
3)yum remove mysql-server mysql mysql-devel -y //卸载之前版本
4)yum install ncurses-devel -y
5)mkdir -pv /usr/local/mysql/data //递归显示创建目录
6)tar fvxz mysql-5.5.29.tar.gz
cd mysql-5.5.29
cmake \
> -DCMAKE_INSTALL_PREFIX=/usr/local/mysql/ \
> -DMYSQL_DATADIR=/usr/local/mysql/data/ -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \
> -DWITH_INNODBBASE_STORAGE_ENGINE=1 \
> -DENABLE_LOCAL_INFILE=1 \
> -DEXTRA_CHARSETS=all \
> -DDEFAULT_CHARSET=utf8 \
> -DDEFAULT_COLLATION=utf8_general_ci \
> -DMYSQL_USER=mysql \
> -DWITH_DEBUG=0 \
> -DWITH_EMBEDED_SERVER=0
7)make && make install
8)cp support-files/my-innodb-heavy-4G.cnf /etc/my.cnf
9)vim /etc/my.cnf
[mysqld] //此位置下添入下行
skip-name-resolve = 1
10)cp support-files/mysql.server /etc/init.d/mysqlsource
11)chmod 755 /etc/init.d/mysqlsource
chown -R mysql.mysql /usr/local/mysql/
12)sh scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/ //初始化数据库,并指定库路径和数据路径
12)做软连接
ln -s /usr/local/mysql/bin/* /usr/bin/
ln -s /usr/local/mysql/lib/* /usr/lib/
ln -s /usr/local/mysql/libexec/* /usr/local/libexec/
ln -s /usr/local/mysql/share/man/man1/* /usr/share/man/man1/
ln -s /usr/local/mysql/share/man/man8/* /usr/share/man/man8/
五、安装相关软件包
1)tar fvxz libiconv-1.14.tar.gz
cd libiconv-1.14/
./configure --prefix=/usr/local/ --with-apr=/usr/local/apr
make && make install
2)tar fvxz libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8/
./configure && make && make install
cd libltdl/
./configure --enable-ltdl-install && make && make install
3) tar fvxz mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9/
./configure && make && make install
4)ln -s /usr/local/lib/* /usr/lib/
ln -s /usr/local/bin/libmcrypt-config /usr/bin/
5)tar fvxz mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8/
./configure && make && make install
六、安装配置PHP
1)yum install libxml2-devel libpng-devel bzip2-devel curl-devel libjpeg-devel freetype-devel net-snmp-devel -y
2)tar fvxj php-5.4.11.tar.bz2
3)cd php-5.4.11/
4)./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql/ --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=/usr/local/mysql --with-iconv-dir=/usr/local/ --enable-fpm --with-fpm-user=apache --with-fpm-group=apache --with-pcre-regex --with-zlib --with-bz2 --enable-calendar --disable-phar --with-curl --enable-dba --with-libxml-dir --enable-ftp --with-gd --with-jpeg-dir --with-png-dir --with-zlib-dir --with-freetype-dir --enable-gd-native-ttf --enable-gd-jis-conv --with-mhash --enable-mbstring --with-mcrypt --enable-pcntl --enable-xml --disable-rpath --enable-shmop --enable-sockets --enable-zip --enable-bcmath --with-snmp --disable-ipv6 --disable-rpath --disable-debug --with-apxs2=/usr/local/apache2/bin/apxs
make ZEND_EXTRA_LIBS='-liconv'
make install
5)cp php.ini-production /usr/local/php/etc/php.ini
6)vim /usr/local/apache2/conf/httpd.conf
(a)/AddType //搜索关键字
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php //添加行
(b)/IfModule dir_module //搜索关键字
DirectoryIndex index.php //修改行
7)vim /usr/local/php/etc/php.ini
short_open_tag = On //修改行
8)cd /usr/local/apache2/htdocs/
rm -f index.html
vim index.php
Hello World
七、查看Apache服务,并重新启动
ps -aux | grep httpd
killall httpd
/usr/local/apache2/bin/apachectl -k restart
八、论坛文件的修改
unzip Discuz_7.2_FULL_SC_UTF8.zip
mv upload/* /usr/local/apache2/htdocs/ //移动论坛文件
cd /usr/local/apache2/htdocs
chmod -R 777 * //修改目录下所有文件的权限
九、启动Apache && Mysql服务 && 访问配置
1)/usr/local/apache2/bin/apachectl -k restart //启动Apache服务
2)/etc/init.d/mysqlsource start //启动Mysql 服务
3)虚拟机访问 http://192.168.18.59/install/index.php
本机访问 http://192.168.18.59

由荣新宫老师投稿。

  • 我的微博
  • 这是微博的扫一扫
  • weinxin
  • 微信公众
  • 微信公众号扫一扫
  • weinxin

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

目前评论:66   其中:访客  59   博主  7

    • avatar Begin 6

      图文并茂! 只是有些人看不见图而已!

        • avatar Penn Admin

          @Begin 有的时候,命令比图好使!

        • avatar RAW9426 7

          签到成功!这里是机器人WT142857号,每日打卡,生活更精彩哦!

          • avatar 霞躺诳傧邻沤帘诿屹暮驮淘瀑枪匪垦搜骨 9

            签到成功!签到时间:今日的上午7:31:48,每日打卡,生活更精彩哦!

            • avatar 俸张岳人悦篮那磕衙章翱酵泳簧吠媒隙猿 9

              签到成功!签到时间:今日的上午4:18:21,每日打卡,生活更精彩哦!

              • avatar 厥及腊蚀酱魏汗伦履炎醇附思潘宗谖泊盘 9

                签到成功!签到时间:今日的上午12:19:58,每日打卡,生活更精彩哦!

                • avatar 鲜粗筛蠢盎廊度铀破秃亿氨囱惭第林鬃嘉 9

                  签到成功!签到时间:今日的下午10:56:44,每日打卡,生活更精彩哦!

                  • avatar 搅坷傲晃每沃钒沃的宜固猎战瘴蹲顺繁倒 9

                    签到成功!签到时间:今日的下午6:36:50,每日打卡,生活更精彩哦!