CentOS 环境安装所需命令

防火墙firewalld

systemctl start firewalld

systemctl enable firewalld 

firewall-cmd --zone=public --add-port=80/tcp --permanent    (--permanent永久生效,没有此参数重启后失效)

firewall-cmd --zone=public --remove-port=234/tcp --permanent

firewall-cmd --reload

firewall-cmd --query-port=80/tcp

firewall-cmd --zone=public --list-ports

firewall-cmd --add-forward-port=port=80:proto=tcp:toport=8080

即查看分配网卡情况

  ip addr

编辑sudo文件

      visudo

vim替换

%s/\/dev\//\/prod\//gc    /dev/ 替换为 /prod/

 

ssh日志

/var/log/secure

 

添加用户

useradd ${name} -m -U

chmod -v u+w /etc/sudoers

vim /etc/sudoers

ALL=(ALL) ALL

chmod -v u-w /etc/sudoers

 

ssh开通

vim /etc/ssh/ssh_config

port 22

PubkeyAuthentication yes

PermitRootLogin no

PasswordAuthentication no

ListenAddress 0.0.0.0

ListenAddress ::

ps -e | grep sshd

netstat -an | grep 324

cd /home/user/

chmod 700 .ssh

cd.ssh

chmod 600 authorized_keys

 

seLinux

semanage port -l|grep ssh

semanage port -a -t ssh_port_t -p tcp 324

 

 

openresty

wget https://openresty.org/package/centos/openresty.repo

sudo mv openresty.repo /etc/yum.repos.d/

sudo yum check-update

sudo yum install openresty

vim ~/.bash_profile

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

sudo vim /etc/sysctl.conf

sudo sysctl -p /etc/sysctl.conf
 net.ipv4.ip_forward = 1

sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080

 

 

jenkins

nohup  java -jar jenkins.war --httpPort=9090 --httpListenAddress=127.0.0.1 --enable-future-java >> /home/sai/logs/jenkins/log &

 

 

mysql 

sudo yum install mysql80-community-release-el8-1.noarch.rpm

yum repolist enabled | grep "mysql.*-community.*"

 

yum repolist all | grep mysql

sudo yum-config-manager --disable mysql57-community

sudo yum-config-manager --enable mysql80-community

sudo dnf config-manager --disable mysql57-community

sudo dnf config-manager --enable mysql80-community

 

yum repolist enabled | grep mysql

(EL8 systems only)sudo yum module disable mysql

sudo yum install mysql-community-server

systemctl start mysqld

systemctl status mysqld

sudo grep 'temporary password' /var/log/mysqld.log

mysql -uroot -p

ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';

posted @ 2017-12-14 09:17  adeveloper  阅读(164)  评论(0编辑  收藏  举报