CentOS 基本操作

修改更新源

cd /etc/yum.repos.d
mkdir bak
mv * bak/
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
yum clean all
yum makecache

标准软件

yum install -y nc
yum install -y gcc
yum groupinstall -y "Development Tools"
yum install -y git

cd /usr/local/src
git clone https://github.com/FiloSottile/axel.git
cd axel
./configure
make 
make install

cd /etc/ssh
sed -i '/GSSAPIAuthentication/d' sshd_config
sed -i '/UseDNS/d' sshd_config
echo 'GSSAPIAuthentication no' >> sshd_config
echo 'UseDNS no' >> sshd_config
service sshd restart

网卡名字修改

/etc/udev/rules.d/70-persistent-net.rules  
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:eb:88:95", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

网卡静态地址配置

## Configure eth0
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static
NAME="System eth0"
UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03
IPADDR=192.168.1.44
NETMASK=255.255.255.0


## Configure Default Gateway
#
# vi /etc/sysconfig/network

NETWORKING=yes
HOSTNAME=centos6
GATEWAY=192.168.1.1


## Restart Network Interface
#

/etc/init.d/network restart

## Configure DNS Server
#
# vi /etc/resolv.conf

nameserver 8.8.8.8      # Replace with your nameserver ip
nameserver 192.168.1.1  # Replace with your nameserver ip

磁盘格式化

yum install -y xfsprogs-devel

时区调整

cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
修改为中国的东八区# vi /etc/sysconfig/clockZONE="Asia/Shanghai"
UTC=false
ARC=false

时钟同步

ntpdate asia.pool.ntp.org

配置主机名

假设机器名为XX

1. 使用hostname XX给系统配置机器名
2. 查看/etc/sysconfig/network, 确保HOSTNAME与上面配置的一致
3. 确保 /etc/hosts文件里面有如下三行,至少有最后一行。
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.0.111 XX
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值