您现在的位置是:网站首页 > 学无止境
Linux系统常用命令及故障解决
Linux系统常用命令及故障解决
Linux#######命令篇##############
systemctl set-default multi-user.target
###防火墙######状态篇##############
firewall-cmd --state 查看防火墙状态
--
systemctl stop firewalld.service
systemctl disable firewalld.service 禁止开机启动
--
systemctl start firewalld.service
systemctl restart iptables.service 重启防火墙配置
systemctl enable iptables.service 设置开机启动
###Nginx######安装篇##############
systemctl status nginx.service
systemctl enable nginx.service
systemctl start nginx.service
systemctl disable nginx.service
https://www.cnblogs.com/taiyonghai/p/6728707.html
--第一步: 切换root用户 su
--第二步: 组件
GNU编译器:
rpm -qa|grep gcc-c++
gcc-c++ yum install gcc-c++
安全协议组件:
openssl https://www.openssl.org/source/openssl-fips-2.0.16.tar.gz
Perl正则模块: Rewrite模块和HTTP核心模块
pcre https://ftp.pcre.org/pub/pcre/pcre-8.41.tar.gz
Gzip压缩功能:
zlib http://www.zlib.net/fossils/zlib-1.2.11.tar.gz
组件: 解压-配置-编译-安装
tar zxvf openssl-fips-2.0.16.tar.gz
cd openssl-fips-2.0.16
./config && make && make install
tar zxvf pcre-8.41.tar.gz
cd pcre-8.41
./configure && make && make install
tar zxvf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure && make && make install
--第三步: Nginx安装
Nginx下载: Stable version:最新稳定版,生产环境上建议使用的版本
Nginx http://nginx.org/download/nginx-1.12.2.tar.gz
Nginx: 解压-配置-编译-安装
tar zxvf nginx-1.12.2.tar.gz
cd nginx-1.12.2
./configure && make && make install
--第四步: Nginx开机启动服务
vim /lib/systemd/system/nginx.service
[Unit] ##说明
Description=nginx
After=network.target ##描述服务类型
[Service]
Type=forking ##后台形式运行
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s quit
PrivateTmp=true ##给服务独立分配临时空间
[Install]
WantedBy=multi-user.target ##运行级别 为3
Nginx服务命令:
systemctl status nginx.service
systemctl start nginx.service
systemctl enable nginx.service
--Nginx安装完毕。
###Nginx######配置篇##############
vim /etc/hosts 虚拟域名列表
###Mysql######安装篇##############
--第一步: 准备软件
mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz
https://dev.mysql.com/downloads/mysql/5.6.html#downloads
--第二步: 卸载清除
rpm -qa|grep mariadb
rpm -e --nodeps mariadb-libs-5.5.44-2.el7.centos.x86_64
rm /etc.my.cnf
--第三步: 创建用户和组
groupadd mysql
useradd -g mysql mysql
cd /usr/local/mysql
chown -R mysql:mysql ./
./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/
chown -R mysql:mysql data
--数据库安装完毕。
###Mysql######配置篇##############
chown 777 /usr/local/mysql/my.cnf
cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld
chmod +x /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
chkconfig --list mysqld
vim ~/.bash_profile
尾部加入:
export PATH=$PATH:/usr/local/mysql/bin
source ~/.bash_profile
--启动
systemctl start mysqld.service
--配置密码
mysql>use mysql;
mysql>update user set password=password('zha123456') where user='root' and host='localhost';
mysql>flush privileges;
--远程权限
mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'zha123456' WITH GRANT OPTION;
mysql>flush privileges;
问题故障0: FATAL ERROR: please install the following Perl modules before executing ./scripts/mysql_install_db:Data::Dumper
yum -y install autoconf
问题故障1: Another app is currently holding the yum lock; waiting for it to exit...
rm -rf /var/run/yum.pid
问题故障2: Starting MySQL ** mysqld_safe Directory '/var/lib/mysql' for UNIX socket file don't exists
mv /etc/my.cnf /etc/my-back.cnf
###PHP######安装篇##############
yum remove php-common
php5.6源:
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum list php*
yum install php56w php56w-mysql php56w-gd libjpeg* php56w-ldap php56w-odbc php56w-pear php56w-xml php56w-xmlrpc php56w-mbstring php56w-bcmath
################################################################
http://www.linuxidc.com/Linux/2017-10/147581.htm?hmsr=toutiao.io
https://www.cnblogs.com/37yan/p/6879404.html
--组件
yum install libxml2
yum install libxml2-devel
yum install openssl openssl-devel
yum -y install curl-devel
yum install libjpeg libpng freetype libjpeg-devel libpng-devel freetype-devel -y
php5.6下载
wget http://cn2.php.net/distributions/php-5.6.5.tar.gz
tar -zxvf php-5.6.5.tar.gz
mv php-5.6.5 /usr/local/php56
cd /usr/local/php56
./configure && make && make install
http://am1.php.net/distributions/php-5.6.33.tar.gz
tar -zxvf
./configure -enable-fpm
make && make install
/usr/local/sbin/php-fpm
cd /usr/local/etc/
cp php-fpm.conf.default php-fpm.conf
######################################################################################
问题故障0:FATAL ERROR: please install the following Perl modules before executing ./scripts/mysql_install_db:Data::Dumper
yum -y install autoconf
问题故障1: Another app is currently holding the yum lock; waiting for it to exit...
rm -rf /var/run/yum.pid
下一篇:SQL编程 从新手进阶到高手