安装centos时要用到的一些东西,自己用的

修改静态IP
/etc/sysconfig/network-scripts/ifcfg-eth0
# Broadcom Corporation NetXtreme II BCM5716 Gigabit Ethernet
DEVICE=eth1
HWADDR=78:2B:CB:2B:48:2D
ONBOOT=yes
HOTPLUG=no
BOOTPROTO=static
TYPE=Ethernet
NETMASK=255.255.255.0
IPADDR=192.168.0.164
GATEWAY=192.168.0.172
PEERDNS=no


多IP
cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:1

设置DNS
vi /etc/resolv.conf
nameserver 8.8.8.8

升级支持ReiserFS
1. 查看CentOS 内核升级包
yum --disablerepo updates,base --enablerepo=centosplus list 'kernel*'
2. 安装要升级的kernel包名称
yum --disablerepo updates,base --enablerepo=centosplus install kernel.x86_64
3. 安装reiserfs工具
yum --disablerepo updates,base --enablerepo=centosplus install reiserfs-utils.x86_64

升级系统
yum -y update

安装常用包
yum -y install gcc* gcc-c++* autoconf* automake* zlib* libxml* ncurses-devel* libmcrypt* libtool* openssl-devel sysstat net-snmp make

开启系统服务
chkconfig --level 2345 mysqld3306 on

查看某个端口是否监听
netstat -tunl | grep 8200

你打包/home这个目录,/home/123/是你不想打包的目录
tar cvf my.bak.tar /home --exclude /home/123

强制拷贝文件夹
cp -rfu /src /dest

apache生成密码
htpasswd -c /conf/awstats_passwd awstats_admin

添加path路径
vi /etc/profile
让/etc/profile文件修改后立即生效 ,可以使用如下命令:
# .  /etc/profile
注意: . 和 /etc/profile 有空格.

查看目录大小
du -S | sort -n

查看某一进程占用的内存大小
ps aux|grep videobox-api|grep startup|awk '{print $6}'

关闭SELINUX
/usr/sbin/setenforce 0 立刻关闭 SELINUX
/usr/sbin/setenforce 1 立刻启用 SELINUX

加到系统默认启动里面
echo "/usr/sbin/setenforce 0" >> /etc/rc.local


iptables限制同一IP连接数
iptables -I INPUT -p tcp --dport 80 -m connlimit --connlimit-above 10 -j DROP

查看端口占用情况
lsof -i:21


用rm提示参数列表过长的解决办法

在linux中删除大量文件时,直接用rm会出现:-bash: /bin/rm: 参数列表过长,的错误。

这时可以用find命令来结合使用。
例:
1、rm * -rf 改为:
      find . -name "*" | xargs rm -rf '*' 就行了。
2、rm test* -rf 改为:
      find . -name "test*" | xargs rm -rf "test*"

你可能感兴趣的:(centos)