Shell脚本一键配置LAMP环境-脚本实例和解释_shell ld_library_path

tar zxf /mnt/tar/cmake-2.8.6.tar.gz -C /usr/src

cd /usr/src/cmake-2.8.6

./configure

gmake && gmake install

#创建mysql用户

groupadd mysql

useradd -M -g mysql mysql

#源代码安装的mysql

tar zxf /mnt/tar/mysql-5.6.36.tar.gz -C /usr/src

cd /usr/src/mysql-5.6.36/

cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DSYSCONFDIR=/etc -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all

make && make install

#加强mysql用户权限

chown -R mysql:mysql /usr/local/mysql

rm  -rf   /etc/my.cnf

cp  /usr/src/mysql-5.6.36/support-files/my-default.cnf    /etc/my.cnf

#初始化数据库

/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data/

#设置环境变量

echo “PATH=$PATH:/usr/local/mysql/bin”    >> /etc/profile

./etc/profile

#添加系统服务

cp  /usr/src/mysql-5.6.36/support-files/mysql.server   /etc/init.d/mysqld

chmod  +x  /etc/init.d/mysqld

chkconfig  --add  mysqld

systemctl start mysqld

#安装PHP

rpm -e php php-cli php-ldap php-common php-mysql --nodeps

#安装依赖包

rpm -ivh /mnt/Packages/zlib-devel-1.2.7-17.el7.x86_64.rpm

rpm -ivh /mnt/Packages/xz-devel-5.2.2-1.el7.x86_64.rpm

rpm -ivh /mnt/Packages/libxml2-devel-2.9.1-6.el7_2.3.x86_64.rpm

#安装libcrypt

tar zxf /mnt/tar/libmcrypt-2.5.8.tar.gz -C /usr/src

cd   /usr/src/libmcrypt-2.5.8

./configure && make && make install

ln  -s  /usr/local/lib/libmcrypt.*    /usr/lib/

#安装mhash

tar zxf /mnt/tar/mhash-0.9.9.9.tar.gz -C /usr/src

cd /usr/src/mhash-0.9.9.9/

./configure && make && make install

ln -s /usr/local/lib/libmhash*   /usr/lib/

#安装mcrypt

tar zxf /mnt/tar/mcrypt-2.6.8.tar.gz -C /usr/src

cd /usr/src/mcrypt-2.6.8/

export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

./configure && make && make install

#安装php

tar zxf /mnt/tar/php-5.5.38.tar.gz -C /usr/src

cd /usr/src/php-5.5.38/

./configure --prefix=/usr/local/php5 --with-mcrypt --with-apxs2=/usr/local/httpd/bin/apxs --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-config-file-path=/usr/local/php5 --enable-mbstring

make && make install

cp -f /usr/src/php-5.5.38/php.ini-development /usr/local/php5/php.ini

#更改配置文件

sed -i ‘s/short_open_tag.*$/short_open_tag=Off/g’ /usr/local/php5/php.ini

sed -i ‘$a extension=php_mysqli.dll’ /usr/local/php5/php.ini

sed -i ‘s/DirectoryIndex.*$/DirectoryIndex index.html index.php/g’ /usr/local/httpd/conf/httpd.conf

sed -i ‘$a AddType application/x-httpd-php  .php’ /usr/local/httpd/conf/httpd.conf

#测试

/usr/local/httpd/bin/apachectl  restart

echo -e “<?php\nphpinfo();\n?>” > /usr/local/httpd/htdocs/test1.php

最后的话

最近很多小伙伴找我要Linux学习资料,于是我翻箱倒柜,整理了一些优质资源,涵盖视频、电子书、PPT等共享给大家!

资料预览

给大家整理的视频资料:

给大家整理的电子书资料:

如果本文对你有帮助,欢迎点赞、收藏、转发给朋友,让我有持续创作的动力!

加入社区》https://bbs.csdn.net/forums/4304bb5a486d4c3ab8389e65ecb71ac0
存中…(img-CJhQzXdK-1725736116516)]

如果本文对你有帮助,欢迎点赞、收藏、转发给朋友,让我有持续创作的动力!

加入社区》https://bbs.csdn.net/forums/4304bb5a486d4c3ab8389e65ecb71ac0

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值