centos6安装完成之后必要的配置


centos6安装完成之后必要的配置

一配置yum源

[root@centos61 ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2523  100  2523    0     0  10826      0 --:--:-- --:--:-- --:--:-- 24735
[root@centos61 ~]# cat   /etc/yum.repos.d/CentOS-Base.repo 
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#
 
[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
 
#released updates 
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
 
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
 
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
[root@centos61 ~]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
--2019-12-10 19:22:08--  http://mirrors.aliyun.com/repo/epel-6.repo
Resolving mirrors.aliyun.com... 117.161.115.189, 117.161.115.192, 117.161.115.190, ...
Connecting to mirrors.aliyun.com|117.161.115.189|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 664 [application/octet-stream]
Saving to: “/etc/yum.repos.d/epel.repo”

100%[==============================================================>] 664         --.-K/s   in 0s      

2019-12-10 19:22:08 (136 MB/s) - “/etc/yum.repos.d/epel.repo” saved [664/664]
[root@centos61 yum.repos.d]# cat /etc/yum.repos.d/epel.repo 
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
baseurl=http://mirrors.aliyun.com/epel/6/$basearch
failovermethod=priority
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
 
[epel-debuginfo]
name=Extra Packages for Enterprise Linux 6 - $basearch - Debug
baseurl=http://mirrors.aliyun.com/epel/6/$basearch/debug
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
gpgcheck=0
 
[epel-source]
name=Extra Packages for Enterprise Linux 6 - $basearch - Source
baseurl=http://mirrors.aliyun.com/epel/6/SRPMS
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
gpgcheck=0
[root@centos61 yum.repos.d]#  yum  repolist
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
repo id                      repo name                                                            status
base                         CentOS-6 - Base - mirrors.aliyun.com                                  6,713
epel                         Extra Packages for Enterprise Linux 6 - x86_64                       12,582
extras                       CentOS-6 - Extras - mirrors.aliyun.com                                   46
updates                      CentOS-6 - Updates - mirrors.aliyun.com                                 770
repolist: 20,111
[root@centos61 yum.repos.d]# ls
bak  base.repo  CentOS-Base.repo  epel.repo
[root@centos61 yum.repos.d]# pwd
/etc/yum.repos.d

二安装必要的软件包

[root@centos61 ~]# yum   install -y   vim   tree   telnet   nc   nmap   net-tools   wget   bash-completion   lrzsz  chrony   bc
[root@centos61 ~]# yum   install   bash-completion
Loaded plugins: fastestmirror
Setting up Install Process
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
Repository base is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package bash-completion.noarch 1:1.3-7.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================
 Package                       Arch                 Version                    Repository          Size
========================================================================================================
Installing:
 bash-completion               noarch               1:1.3-7.el6                epel               216 k

Transaction Summary
========================================================================================================
Install       1 Package(s)

Total download size: 216 k
Installed size: 576 k
Is this ok [y/N]: y
Downloading Packages:
bash-completion-1.3-7.el6.noarch.rpm                                             | 216 kB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : 1:bash-completion-1.3-7.el6.noarch                                                   1/1 
  Verifying  : 1:bash-completion-1.3-7.el6.noarch                                                   1/1 

Installed:
  bash-completion.noarch 1:1.3-7.el6                                                                    

Complete!
[root@centos61 ~]# 

三创建目录

存放shell脚本文件/shell_scripts

[root@centos61 ~]# mkdir  /shell_scripts,/app
mkdir: cannot create directory `/shell_scripts,/app': No such file or directory
[root@centos61 ~]# ls  /
app  boot  etc   lib    lost+found  mnt  proc  sbin     srv  tmp  var
bin  dev   home  lib64  media       opt  root  selinux  sys  usr
[root@centos61 ~]# mkdir  /shell_scripts
[root@centos61 ~]# mkdir  /app/
mkdir: cannot create directory `/app/': File exists
[root@centos61 ~]# ls /app/
lost+found
[root@centos61 ~]# df
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/sda2       50264772  908844  46795928   2% /
tmpfs             502068       0    502068   0% /dev/shm
/dev/sda3       20027260   44992  18958268   1% /app
/dev/sda1         999320   30508    916384   4% /boot
/dev/sr0         3824484 3824484         0 100% /mnt
[root@centos61 ~]# lsblk 
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sr0     11:0    1  3.7G  0 rom  /mnt
sda      8:0    0  200G  0 disk 
├─sda1   8:1    0    1G  0 part /boot
├─sda2   8:2    0 48.8G  0 part /
├─sda3   8:3    0 19.5G  0 part /app
├─sda4   8:4    0    1K  0 part 
└─sda5   8:5    0    2G  0 part [SWAP]
[root@centos61 ~]# 

四设置别名

[root@centos61 ~]# tail  -3   /etc/bashrc   
alias vinet0='vim  /etc/sysconfig/network-scripts/ifcfg-eth0'
alias catnet0='cat /etc/sysconfig/network-scripts/ifcfg-eth0'

[root@centos61 ~]# .  /etc/bashrc   
[root@centos61 ~]# alias 
alias catnet0='cat /etc/sysconfig/network-scripts/ifcfg-eth0'
alias cp='cp -i'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias mv='mv -i'
alias rm='rm -i'
alias vinet0='vim  /etc/sysconfig/network-scripts/ifcfg-eth0'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'

猜你喜欢

转载自www.cnblogs.com/wang618/p/12018538.html