关闭

CentOS 基本操作

标签: centos
112人阅读 评论(0) 收藏 举报
分类:

修改更新源

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
0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:259765次
    • 积分:10126
    • 等级:
    • 排名:第1686名
    • 原创:779篇
    • 转载:34篇
    • 译文:5篇
    • 评论:50条
    链接
    文章分类
    最新评论
    google analysis