linux服务器(centos)LNMP环境配置(附各种拓展)

linux服务器(centos)环境配置

1.PHP7.2版本
//如果找不到7.2版本,先yum update
yum -y install epel-release
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum -y install php72w php72w-opcache
yum -y install php72w-fpm
yum -y install php72w-devel

2.C++支持
yum -y install gcc
yum -y install gcc-c++

3.mbString支持
yum -y install php72w-mbstring

4.数学函数拓展
yum -y install php72w-bcmath

5.关键字过滤拓展(trie_filter)
https://www.cnblogs.com/jhcyzxx/p/10479763.html
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
tar -zxf libiconv-1.14.tar.gz
vim libiconv-1.14/srclib/stdio.in.h
将698行代码:
_GL_WARN_ON_USE (gets, “gets is a security hole - use fgets instead”);
替换为
#if defined(__GLIBC__) && !defined(__UCLIBC__) && !__GLIBC_PREREQ(2, 16)
_GL_WARN_ON_USE (gets, “gets is a security hole - use fgets instead”);
#endif
cd libiconv-1.14
./configure
make && make install

wget ftp://linux.thai.net/pub/ThaiLinux/software/libthai/libdatrie-0.2.4.tar.gz
tar -zxf libdatrie-0.2.4.tar.gz
cd libdatrie-0.2.4

./configure --prefix=/usr/local/libdatrie/
make ICONV_LIBS=’/usr/local/lib/libiconv.so’
make install

wget https://github.com/wulijun/php-ext-trie-filter/archive/master.zip
unzip master.zip
cd php-ext-trie-filter-master/
phpize
./configure --with-php-config=/usr/bin/php-config --with-trie_filter=/usr/local/libdatrie/
make && make install
php.ini 加入 extension=trie_filter.so

6.mongodb拓展
wget https://pecl.php.net/get/mongodb-1.4.4.tgz
tar zxf mongodb-1.4.4.tgz
cd mongodb-1.4.4/
phpize
./configure --with-php-config=php-config
make && make install
php.ini 加入 extension=mongodb.so

7.redis拓展
http://pecl.php.net/package/redis 下载版本对应安装包
//上传安装包 phpredis-develop
yum -y install unzip zip
unzip develop
phpize
./configure
make && make install
php.ini 加入extension=redis.so

8.mysql拓展
yum -y install php72w-mysqlnd

9.图片拓展
yum -y install php72w-gd

10.nginx安装 版本1.16.0
//添加yum源
vim /etc/yum.repos.d/nginx.repo
//写入
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
//使用yum安装
yum -y install nginx
//安装好后配置文件路径· /etc/nginx/nginx.conf

11.mysql安装
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum -y install mysql-server
my.ini文件或者my.cnf 在[mysqld]后添加skip-grant-tables
service mysqld restart
mysql -u root
use mysql;
update user set password=password(‘new password’) where user=‘root’;
flush privileges;//运行生效
允许其他ip访问数据库
grant all privileges on . to root@’%’ identified by “password”;
flush privileges;

12.redis安装
wget http://download.redis.io/releases/redis-4.0.2.tar.gz
tar -zxvf redis-4.0.2.tar.gz
cd redis-4.0.2
make MALLOC=libc
cd src && make install
在redis.conf中配置项目相应参数
启动命令 redis-server redis.conf
如果用现成的文件,需要创建/data/redis文件夹

13.mongodb安装
wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-4.0.0.tgz
下载
tar -zxvf mongodb-linux-x86_64-rhel70-4.0.0.tgz
解压
mv mongodb-linux-x86_64-rhel70-4.0.0/bin/* /usr/bin
在mongodb.conf中配置项目相应参数
启动 mongod --config /etc/mongodb.conf

14.nsq安装
http://2e50d179.wiz03.com/share/s/0Kkd5V0ni4l92_AdyM3rFdMC1m9Lrl2Qrkzp2Hu46I0JtL5M
网上下载nsq
创建路径/data/gopath/
将nsq文件夹放入此路径
//赋予权限
chmod -R 777 /data/gopath/nsq
//安装go语言环境
下载地址:wget:https://golangtc.com/download
mv go /usr/local/go
vim /etc/profile
export GOROOT=/usr/local/go
export GOPATH=/data/gopath/nsq
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin

source /etc/profile
cd /data/gopath/nsq/bin
//启动nsqlookupd nohup将程序输出导到当前目录的nohup文件中 &以守护进程方式启动
nohup nsqlookupd &
//启动nsqd 指定lookupd的tcp地址
nohup nsqd --lookupd-tcp-address=127.0.0.1:4160 &
nohup nsqadmin --lookupd-http-address=127.0.0.1:4161 &
//查看地址
http://127.0.0.1:4171/

15 swoole 安装
wget https://github.com/swoole/swoole-src/archive/v1.9.1-stable.tar.gz
tar zxvf v1.9.1-stable.tar.gz
cd swoole-src-1.9.1-stable
phpize
./configure
make && make install
进入php.ini添加extension=swoole.so

16 如果要添加ssl支持
yum -y install php72w-openssl
yum -y install openssl-devel
编译时添加 --enable-openssl

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值