linux

创建命令

mkdir -p 一次性创建层级目录**   一次创建多个目录   mkdir -p oa/web/files/

查看运维关机时间: last -x reboot

net无法联网:

查看运维关机时间: last -x reboot

本地host 文件位置:C:\Windows\System32\drivers\etc

ping 114.114.114.114

vi /etc/resolv.conf
nameserver	114.114.114.114

hosts

vi  /etc/hosts 

重启网络

/etc/init.d/network restart

jdk:

tar -zxvf  jdk-8u241-linux-x64.tar.gz  -C /usr/local/
/usr/liuyang/
tar -zcvf 文件名.tar.gz 要压缩文件路径 
vi /etc/profile 

JAVA_HOME=/usr/local/jdk1.8.0_241/
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=$JAVA_HOME/jre/lib/ext:$JAVA_HOME/lib/tools.jar
export PATH JAVA_HOME CLASSPATH

source /etc/profile
/usr/java/jdk1.8.0_241/

build-nginx:

find  /  -name nginx 
rm -rf /var/log/nginx
rm -rf /usr/local/nginx
rm -rf /usr/local/nginx/nginx-1.12.1/objs/nginx
rm -rf /usr/local/nginx/sbin/nginx

清楚开机自启:
chkconfig nginx off
rm -rf /etc/init.d/nginx

安装:
yum install -y gcc
yum install -y pcre pcre-devel
yum install -y zlib zlib-devel
 tar -zxvf nginx-1.12.1.tar.gz  -C /usr/local
cd /usr/local/
 mv nginx-1.12.1 /usr/local/nginx
 cd /usr/local/nginx/
./configure --prefix=/usr/local/nginx 
make 
make install
mkdir -p  /usr/local/nginx/logs/
touch /usr/local/nginx/logs/error.log
touch /usr/local/nginx/logs/access.log
加上ssh安装:
 /usr/local/nginx/sbin/nginx -V 
find  / -name configure 
./configure --prefix=/usr/local/nginx 
./configure --with-http_ssl_module
 yum -y install openssl openssl-devel 

make
make install

cp /usr/local/nginx/sbin/nginx  /usr/local/nginx/sbin/nginx.bak
cp ./objs/nginx /usr/local/nginx/sbin/

/usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.12.2
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) 
built with OpenSSL 1.0.2k-fips  26 Jan 2017
TLS SNI support enabled
configure arguments: --with-http_ssl_module

测试端口是否跳过去

build-mysql

yum -y install wget
  wget -c http://
  tar -zxvf mysql-5.7.31-linux-glibc2.12-x86_64.tar.gz  -C /usr/local
  yum install libaio -y
  cd /usr/local/
  mv mysql-5.7.31-linux-glibc2.12-x86_64 /usr/local/mysql
   cd /usr/local/mysql/
  mkdir /usr/local/mysql/data
  mkdir /usr/local/mysql/etc
  mkdir /usr/local/mysql/log
  groupadd mysql  
  useradd -r -g mysql -s /sbin/nologin mysql
 
 touch /usr/local/mysql/log/error.log
 touch  /usr/local/mysql/log/show.log
 mkdir /var/log/mariadb
 touch /var/log/mariadb/mariadb.log
 chown -R mysql:mysql /var/log/mariadb/
 vi /etc/my.cnf

 chmod +x /usr/local/mysql/log/error.log
sudo chown -R mysql:mysql /usr/local/mysql
 
 /usr/local/mysql/bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
 
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
mkdir /var/lib/mysql
chmod 777 /var/lib/mysql
 /etc/init.d/mysqld start
tailf /usr/local/mysql/log/error.log
 netstat -ntlp mysql
 ps aux|grep mysql
 【my.cnf】
[mysqld]
port=3306

basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
max_connections= 100
default-storage-engine= InnoDB
character-set-server=utf8
log-error= /usr/local/mysql/log/error.log
slow_query_log= 1
long-query-time= 30
slow_query_log_file=  /usr/local/mysql/log/show.log
min_examined_row_limit= 1000
log-slow-slave-statements
log-queries-not-using-indexes

log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid

!includedir /etc/my.cnf.d
#mysql -u root -p返回-bash: mysql: 未找到命令
两种方式可以都去试一下
ln -s /usr/local/mysql/bin/mysql /usr/bin
ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
加远程权限: 
use mysql;
select  User,authentication_string,Host from user;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '你的密码'  
flush privileges; 
gza:  
use mysql;
ALTER USER USER() IDENTIFIED BY ‘assets123456';
select  User,authentication_string,Host from user;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '!Ps123456'  
flush privileges; 

所有的前提都是需要把防火墙关掉
为远程加上权限密码和本地一致

修改默认(本地密码)
通讯录
ALTER USER USER() IDENTIFIED BY 'root';

feedback密码:
ALTER USER USER() IDENTIFIED BY 'hengtian';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'hengtian'  

忘记密码:
update user set authentication_string="8OP7glVfAmLyiX89" where user = "root";        在mysql8.0 的时候只识别 双引号
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '8OP7glVfAmLyiX89'  
flush privileges; 

assets EDV
select  User,authentication_string,Host from user;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'assets123456'  
flush privileges; 


数据库启动**:/etc/init.d/mysqld start

数据库关闭:/etc/init.d/mysqld start

数据库重启 ;/etc/init.d/mysqld restart
chown -R mysql:mysql /usr/local/mysql/data/
chmod -R 755 /usr/local/mysql/data
跳过密码权限:
skip-networking
skip-grant-tables

 use mysql; 
 UPDATE user SET `password_expired`='N' where user='root';   *##将密码过期修改为 密码不过期;* 
 select * from mysql.user where user='root' \G; *#查看数据* 
 UPDATE user SET `authentication_string` = PASSWORD("assets123456");  *##修改密码;* 
 flush privileges;  

两个问题:
list 页面无法找到, 问题是 null 匹配
修改vi .etc/mycnf sql_mode=
修改前段页面访问工作流路径
ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

build-redis:

requirepass   appendonly  yes修改配置文件:

redis-server redis.conf &  指定配置文件启动

gza:/usr/local/redis/redis.conf

bin /usr/local/redis/bin/

/usr/local/redis/src/redis-server  所在位置

./usr/local/redis/src/redis-server   /usr/local/redis/redis.conf

/usr/local/redis/redis.conf

修改:

daemonize    

requirepass  设置密码
tar -zvxf /usr/liuyang/redis-5.0.8.tar.gz -C /usr/local/redis
yum install gcc-c++
cd /usr/local/redis/redis-5.0.8
make
make install

cp /usr/local/redis/redis-5.0.8/redis.conf /usr/local/bin
cd /usr/local/bin
ll -a
vi redis.conf
kill -9 $(ps -ef|grep redis | awk '{print $2}')
/usr/local/bin/redis-server  /usr/local/bin/
band *

你可能感兴趣的:(linux,nginx,运维)