美文网首页
centos7 lnmp(新)自定义安装

centos7 lnmp(新)自定义安装

作者: 流浪君子 | 来源:发表于2020-05-22 09:17 被阅读0次

    yum命令报错

    Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was

    14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"

    /etc/resolv.conf

    加入

    nameserver 8.8.8.8

    Mysql-8.0.18安装

    tar -zxvf mysql-8.0.18-el7-x86_64.tar.gz

    mv mysql-8.0.18-el7-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

    vim /etc/my.cnf

    [mysqld]

    # 设置3306端口

    port=3306

    # 设置mysql的安装目录

    basedir=/usr/local/mysql

    # 设置mysql数据库的数据的存放目录

    datadir=/usr/local/mysql/data

    # 允许最大连接数

    max_connections=10000

    # 允许连接失败的次数。这是为了防止有人从该主机试图攻击数据库系统

    max_connect_errors=10

    # 服务端使用的字符集默认为UTF8

    character-set-server=utf8

    # 创建新表时将使用的默认存储引擎

    default-storage-engine=INNODB

    # 默认使用“mysql_native_password”插件认证

    default_authentication_plugin=mysql_native_password

    [mysql]

    # 设置mysql客户端默认字符集

    default-character-set=utf8

    [client]

    # 设置mysql客户端连接服务端时默认使用的端口

    port=3306

    default-character-set=utf8

    配置环境变量

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

    然后立马生效,执行

    source /etc/profile

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

    初始化

    ./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

    启动mysqld服务

    service mysqld start

    /bin/systemctl start mysqld.service

    如果失败,删除

    /tmp/mysql.sock

    /tmp/mysql.sock.lock

    原密码:

    g24?(42r2Ss3

    g:k(4)I8Jt6/

    iQg8grqsDy+%

    修改密码

    ALTER USER 'root'@'localhost' IDENTIFIED BY '*Lin424802!';

    ALTER USER 'root'@'localhost' IDENTIFIED BY 'Xiaozhangbang2019';

    set password = password('*Lin424802!');

    添加远程连接权限

    use mysql;

    update user set host="%" where user='root';

    原因显示:host+user 应该是联合主键,冲突了

    select user,host from user;

    update user set host = '%' where user = 'root' and host='localhost';

    GRANT ALL ON *.* TO 'root'@'%';

    flush privileges;

    ****安装PHP 7.0.1

    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

    tar -zxvf php-7.0.1.tar.gz

    ./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 <evp.h>

    yum -y install openssl openssl-devel

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

    yum -y install php-mcrypt limcrypt libmcrypt-devel

    没有可用软件包 php-mcrypt。

    没有可用软件包 limcrypt。

    没有可用软件包 libmcrypt-devel。

    错误:无须任何处理

    yum -y install epel-release  //扩展包更新包

    yum -y update //更新yum源

    yum -y install php-mcrypt limcrypt libmcrypt-devel

    ./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-mysqli --with-mcrypt=/usr/local/ --enable-opcache=no

    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

    cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.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

    记录linux每个用户操作日志

    通过在/etc/profile里面加入以下代码就可以实现:

    PS1="`whoami`@`hostname`:"'[$PWD]'

    history

    USER_IP=`who -u am i 2>/dev/null| awk '{print $NF}'|sed -e 's/[()]//g'`

    if [ "$USER_IP" = "" ]

    then

    USER_IP=`hostname`

    fi

    if [ ! -d /tmp/history ]

    then

    mkdir /tmp/history

    chmod 777 /tmp/history

    fi

    if [ ! -d /tmp/history/${LOGNAME} ]

    then

    mkdir /tmp/history/${LOGNAME}

    chmod 300 /tmp/history/${LOGNAME}

    fi

    export HISTSIZE=4096

    DT=`date +"%Y%m%d_%H%M%S"`

    export HISTFILE="/tmp/history/${LOGNAME}/${USER_IP} history.$DT"

    chmod 600 /tmp/history/${LOGNAME}/*history* 2>/dev/null

    source /etc/profile 使用脚本生效

    退出用户,重新登录

    sftp

    配置

    http://blog.csdn.net/dawang523/article/details/50067247

    查看sftp错误日志

    tail /var/log/secure

    清理缓存

    echo 1 > /proc/sys/vm/drop_caches

    服务器命令

    启动apache

    /usr/local/apache/bin/apachectl -k start

    /usr/local/apache/bin/apachectl -k stop

    /usr/local/apache/bin/apachectl -k restart

    启动nginx

    /usr/local/nginx/sbin/nginx

    /usr/local/webserver/nginx/sbin/nginx

    重启nginx

    /usr/local/nginx/sbin/nginx -s reload

    /usr/local/webserver/nginx/sbin/nginx -s reload

    启动php-fpm

    /usr/local/php/sbin/php-fpm

    /usr/local/php-5.6.0/sbin/php-fpm

    /usr/local/php/sbin/php-fpm restart

    数据库

    service mysqld start

    service mysqld stop

    相关文章

      网友评论

          本文标题:centos7 lnmp(新)自定义安装

          本文链接:https://www.haomeiwen.com/subject/bfbfahtx.html