centos7 lnmp(老)自定义安装

********************mysql-5.7.17安装

tar -zxvf mysql-5.7.17.tar.gz

mv mysql-5.7.17-linux-glibc2.5-x86_64 mysql

检查mysql组和用户是否存在,如无创建

groupadd mysql    // 建一个msyql的用户和组

useradd -g mysql mysql

mkdir /usr/local/mysql // 创建目录

mkdir /usr/local/mysql/data    // 数据仓库目录

chown -R mysql ./mysql

chgrp -R mysql ./mysql

初始化

./bin/mysqld --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --initialize --console

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

yum install -y libaio

./bin/mysqld --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --initialize --console

密码:

oZkjJd&y;8q,

C:!CLUeK.9

)G*z6jPHHTi#

KPt!lY3(X

R#R&UFuNg5sd

cp ./support-files/my-default.cnf /etc/my.cnf

cp ./support-files/mysql.server /etc/init.d/mysql

修改密码:

mysql -uroot -p

set password=password('BuShu*JTJY2020!');

grant all privileges on *.* to 'root'@'%' identified by 'BuShu*JTJY2020!';

flush privileges;

如果是忘记密码:

vim /etc/my.cnf

在 [mysqld] 的段中加上一句:skip-grant-tables

重启 mysql 服务, service mysql restart

在输入 mysql -u root -p  输入回车即可进入 mysql 数据库

use mysql;

低版本修改:update user set Password = password('BuShu*JTJY2020!') where user = 'root';

高版本修改:update user set authentication_string=password('BuShu*JTJY2020!') where user = 'root';

flush privileges;

配置环境变量

export PATH=/usr/local/mysql/bin:$PATH

然后立马生效,执行

source /etc/profile

Failed to start mysqld.service: Unit not found

首先需要安装mariadb-server

yum install -y mariadb-server

启动服务

/bin/systemctl start mariadb.service

添加到开机启动

/bin/systemctl enable mariadb.service

/bin/systemctl start mysqld.service

********************PHP 5.6.30安装

tar -xzvf php-5.6.30.tar.gz

groupadd httpd

useradd -g httpd httpd

yum install libxml2 -y

yum install libxml2-devel -y

yum install libcurl-devel -y

yum -y install libjpeg-devel libpng-devel

//字体

yum install freetype-devel -y

./configure --prefix=/usr/local/php --with-iconv --with-zlib --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --enable-ftp --with-jpeg-dir --with-freetype-dir --with-png-dir --enable-fpm --with-fpm-user=httpd --with-fpm-group=httpd --with-pdo-mysql --with-mysql --with-mysqli --with-mcrypt=/usr/local/ --enable-opcache=no

报错:no acceptable C compiler found in $PATH

yum -y install gcc-c++

报错:configure: error: Cannot find OpenSSL's

yum -y install openssl openssl-devel

报错:configure: error: mcrypt.h not found. Please reinstall libmcrypt

yum -y install php-mcrypt limcrypt libmcrypt-devel

make && make install

配置环境变量

export PATH=$PATH:/usr/local/php/bin

export PATH=$PATH:/usr/local/php/sbin

然后立马生效,执行

source /etc/profile

cp php.ini-production /usr/local/php/lib/php.ini

cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

修改php.ini

vi /usr/local/php/lib/php.ini

date.timezone = "Asia/Shanghai"

********************安装nginx

tar -zxvf nginx-***

./configure --prefix=/usr/local/nginx --with-http_ssl_module

make && make install

配置环境变量

export PATH=$PATH:/usr/local/nginx/sbin

然后立马生效,执行

source /etc/profile

redis安装

tar -zxf redis-5.0.8.tar.gz

mv redis-5.0.8 redis

2.进入解压文件目录使用make对解压的Redis文件进行编译

cd redis

make && make install

vim redis.conf

将daemonize属性改为yes(表明需要在后台运行)

需要永久配置密码的话就去redis.conf的配置文件中找到requirepass这个参数

requirepass Xiaozhangbang*2020

启动

redis-server

停止

redis-cli shutdown

ps -ef |grep redis

你可能感兴趣的:(centos7 lnmp(老)自定义安装)