centos 调教日记

  • 升级内核

https://www.tecmint.com/install-upgrade-kernel-version-in-centos-7/
https://www.howtoforge.com/tutorial/how-to-upgrade-kernel-in-centos-7-server/

  • 配置 sshd
vim /etc/ssh/sshd_config
# 禁用root账户登录,非必要,但为了安全性,请配置
PermitRootLogin no

# 非严格的权限检查,一般用于非 root 登录
StrictModes yes

# 设置rsa证书登录
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile  .ssh/authorized_keys

# 禁用密码登录
PasswordAuthentication no

# 允许登录的用户
AllowUsers root www

# 重启 sshd
service sshd restart

sshd selinux 的相关配置:https://blog.tinned-software.net/change-ssh-port-in-centos-with-selinux/

http://sharadchhetri.com/2014/10/15/centos-7-rhel-7-change-openssh-port-number-selinux-enabled/

客户端

 ssh-keygen -t rsa
 ssh-keygen -f /tmp/my_key
 # 验证成功,会输出公钥

生成 RSA 4096 ,兼容 jenkins

jenkins 的 ssh-steps 插件对 OpenSSH 的私钥格式支持不佳

ssh-keygen -t rsa -b 4096 -m PEM

参考 ssh 证书登陆设置

验证 SSH 私钥密码

  • 配置短命令
alias ll="ls -lah --color=auto"
alias l="ls -lh --color=auto"
alias grep="grep --color=auto"
alias p="ps -aux|grep"
alias h="history|grep"
alias rm="rm -i"
  • 安装 htop, cpulimit

centos7 安装 htop 需要先安装 epel-release

yum -y install epel-release
yum -y install htop
yum -y install cpulimit

https://www.jianshu.com/p/5629e331f58d

  • 安装 extundelete

linux 数据恢复 centos 下数据恢复 ext3grep extundelete

  • 安装 jdk 1.8
yum -y install java-1.8.0-openjdk*
java -version
  • 设置 java 环境变量

vim /etc/profile

请留意,JAVA_HOME 需要自己留意版本号和路径。

JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA_HOME
export PATH
export CLASSPATH

修改后,使其生效

source /etc/profile
  • 记录操作记录
####################Setting for history################
history
USER=`whoami`
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 /var/log/history ]; then
    mkdir /var/log/history
    chmod 777 /var/log/history
fi
if [ ! -d /var/log/history/${LOGNAME} ]; then
    mkdir /var/log/history/${LOGNAME}
    chmod 300 /var/log/history/${LOGNAME}
fi
export HISTSIZE=4096
DT=`date +"%Y%m%d_%H:%M:%S"`
export HISTFILE="/var/log/history/${LOGNAME}/${USER}@${USER_IP}_$DT"
chmod 600 /var/log/history/${LOGNAME}/*history* 2>/dev/null
######
  • 下载解压 tomcat,喜欢其他版本的,可以在这里找一找 tomcat archive
cd ~
mkdir software
cd software
wget http://archive.apache.org/dist/tomcat/tomcat-8/v8.0.46/bin/apache-tomcat-8.0.46.tar.gz
tar -zxvf apache-tomcat-8.0.46.tar.gz
yum install -y epel-release
yum install -y nginx
# 加入到服务
systemctl start nginx

ps: 如果用非 root 启动 nginx,频繁提示 Permission denied, 可以命令行执行setenforce 0,可能是 selinux 的问题。 Nginx的Permission denied错误

server {
    listen       80;
    server_name  example.com;
    root         /var/www/html;
    index index.html index.htm;
}
  • 安装 g++
yum install -y gcc-c++

yum安装g++

  • jenkins

how-to-install-and-configure-jenkins-on-centos-6-4

Jenkins+maven+git配置

一步一步用jenkins,ansible,supervisor打造一个web构建发布系统

  • node
rpm -ivh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

 rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
 rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-remi
yum -y install nodejs npm --enablerepo=epel

centos 添加 epel 和 remi 源

centos用 yum 方式安装 nodejs 和 npm


参考文档

如何指定进程运行的CPU

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值