首页 > 网站 > 建站经验 > 正文

CentOS7编译安装新版LNMP环境

2019-11-02 16:18:10
字体:
来源:转载
供稿:网友

由于公司要求需要最新版的ZABBIX2.4.4需要最新版的系统CENTOS7和新版的LNMP环境,所以本人摸索着使用新版的环境搭建了LNMP系统,环境版本如下:

系统:CentOS 7 x86_64 NGINX:nginx-1.7.12 数据库:mariadb-10.0.13 PHP:php-5.5.23

首先做一些准备工作,先把centos7的防火墙更换成iptables,可以参见如下链接

centos7防火墙设置iptables

修改成iptables之后就可以清空iptables里面的过滤规则了,然后再关闭selinux服务。记得不要忘了先安装gcc gcc-c++ wget net-tools等功能哦。

首先安装mariadb

应为数据库编译需要很长时间,所以我这里下载的是已经编译好了的二进制包,下载版本为 mariadb-10.0.13-linux-glibc_214-x86_64.tar.gz 

1、下载二进制包到/usr/local/src 目录下:

复制代码 代码如下:[root@centos74 ~]# cd /usr/local/src/

[root@centos74 src]# wget http://ftp.osuosl.org/pub/mariadb/mariadb-10.0.13/bintar-quantal-amd64/mariadb-10.0.13-linux-glibc_214-x86_64.tar.gz[/code]

2、将压缩包解压到/usr/local 目录下:

[code][root@centos74 src]# tar zvxf mariadb-10.0.13-linux-glibc_214-x86_64.tar.gz -C /usr/local/

3、创建mariadb 数据初始化目录/data/mysql:

复制代码 代码如下:[root@centos74 src]# mkdir -p /data/mysql

4、添加系统用户mysql,禁止登陆系统,同时,将mariadb 数据初始化目录所属主和组都修改为mysql:

复制代码 代码如下:[root@centos74 src]# useradd -r -s /sbin/nologin mysql ;chown -R mysql.mysql /data/mysql/

5、重命名解压出来的mariadb 目录:

复制代码 代码如下:[root@centos74 src]# mv /usr/local/mariadb-10.0.13-linux-x86_64/ /usr/local/mysql

6、进入重命名后的目录,初始化mariadb:

[root@centos74 src]# cd /usr/local/mysql/[root@centos74 mysql]# ./scripts/mysql_install_db --datadir=/data/mysql --user=mysqlInstalling MariaDB/MySQL system tables in '/data/mysql' ...140906 2:03:19 [Note] InnoDB: Using mutexes to ref count buffer pool pages140906 2:03:19 [Note] InnoDB: The InnoDB memory heap is disabled140906 2:03:19 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins140906 2:03:19 [Note] InnoDB: Compressed tables use zlib 1.2.3140906 2:03:19 [Note] InnoDB: Using Linux native AIO140906 2:03:19 [Note] InnoDB: Using CPU crc32 instructions140906 2:03:19 [Note] InnoDB: Initializing buffer pool, size = 128.0M........................................................................The latest information about MariaDB is available at http://mariadb.org/.You can find additional information about the MySQL part at:http://dev.mysql.comSupport MariaDB development by buying support/new features fromSkySQL Ab. You can contact us about this at sales@skysql.com.Alternatively consider joining our community based development effort:http://mariadb.com/kb/en/contributing-to-the-mariadb-project/

报错:WARNING: The host 'test4' could not be looked up with resolveip.

解决办法:vim /etc/hosts 在最后一行添加192.168.1.242 test4

报错:./bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表