linux常用装机命令

防火墙:
systemctl stop firewalld
systemctl disable firewalld
systemctl list-unit-files | grep firewalld

ftp服务
启动ftp和开机自启动命令
/bin/systemctl start  vsftpd.service
systemctl enable vsftpd.service
ps -ef |grep ftp
systemctl list-unit-files|grep vsftpd

查看ssh开机自启动
systemctl enable sshd
systemctl list-unit-files | grep ssh

查看ntp是否开机自启动
systemctl status ntpd
systemctl list-unit-files |grep ntpd

安装telnet
rpm -qa|grep telnet;
yum -y install telnet-server;
systemctl start telnet.socket;
systemctl list-unit-files |grep telnet

创建用户
groupadd A
useradd -d /home/nmb -m -g nmc -s /bin/bash hanjf
chown hanjf:A /home/nmcuser
echo xX9#a13Js85kd0Ayi2 | passwd hanjf --stdin

-d指定用户主目录路径
-m如果路径不存在,将自动创建
-s指定默认shell


java环境变量
#java environment
export JAVA_HOME=/usr/local/jdk1.8.0_111
export CLASSPATH=.:${JAVA_HOME}/jre/lib/rt.jar:${JAVA_HOME}/lib/dt.jar:${JAVA_HOME}/lib/tools.jar
export PATH=$PATH:${JAVA_HOME}/bin

最大文件打开数
* soft nofile 65535   
* hard nofile 65535  
echo "* soft nofile 65535"  >> /etc/security/limits.conf
echo "* hard nofile 65535"  >> /etc/security/limits.conf

* soft noproc 11000
* hard noproc 11000

* 代表针对所有用户
noproc 是代表最大进程数
nofile 是代表最大文件打开数

环境变量
历史记录配置
export HISTTIMEFORMAT="%F %T `whoami`     #给history加上时间戳
echo 'export HISTTIMEFORMAT="%F %T `whoami` "' >> /etc/profile
系统空闲等待时长
export TMOUT=300

  

原文地址:https://www.cnblogs.com/hanjianfei/p/11454651.html