装centos系统后必须要做的几件事!!!

定义习惯用的别名

vim .bashrc
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias yy='yum install -y'

修改网卡信息,配置固定ip

vim /etc/sysconfig/network-scripts/ifcfg-ens33
PREFIX=24
BOOTPROTO=static
IPADDR=192.168.245.7
NAME=ens33
DEVICE=ens33
ONBOOT=yes

修改默认颜色

vim /etc/profile.d/env.sh
PS1="\[\e[1;32m\][\u@\h \W]\\$\[\e[0m\]"

修改欢迎界面

vim /etc/motd   #打开配置文件,复制下面的字符

                                                     /*[*/#include<stdio.h>//
                         #include<stdlib.h>//]++++[->++[->+>++++<<]<][(c)2013]
                        #ifndef                                           e//[o
                       #include<string.h>//]![misaka.c,size=3808,crc=d0ec3b36][
                      #define e                                           0x1//
                     typedef struct{int d,b,o,P;char*q,*p;}f;int p,q,d,b,_=0//|
                  #include __FILE__//]>>>[->+>++<<]<[-<<+>>>++<]>>+MISAKA*IMOUTO
                #undef e//[->[-<<+<+<+>>>>]<<<<<++[->>+>>>+<<<<<]>+>+++>+++[>]]b
             #define e(c)/**/if((_!=__LINE__?(_=__LINE__):0)){c;}//[20002,+[-.+]
            ,O,i=0,Q=sizeof(f);static f*P;static FILE*t;static const char*o[]={//
          "\n\40\"8oCan\40not\40open %s\n\0aaFbfeccdeaEbgecbbcda6bcedd#e(bbed$bbd",
        "a6bgcdbbccd#ead$c%bcdea7bccde*b$eebbdda9bsdbeccdbbecdcbbcceed#eaa&bae$cbe",
       "e&cbdd$eldbdeedbbdede)bdcdea&bbde1bedbbcc&b#ccdee&bdcdea'bbcd)e'bad(bae&bccd",
      "e&bbda1bdcdee$bbce#b$c&bdedcd%ecdca4bhcdeebbcd#e$b#ecdcc$bccda7bbcc#e#d%c*bbda",
     ">bad/bbda"};static int S(){return(o[p][q]);}static/**/int/**/Z=0  ;void/**/z(int//
    l){if(/**/Z-l){Z=l;q++;if(p<b*5&&!S()){p+=b;q=0;}}}int main(int I,    /**/char**l){//
   d=sizeof(f*);if(1<(O=_)){b=((sizeof(o)/sizeof(char*))-1)/4;q=22; p=     0;while(p<b*5){
  /*<*/if(Z-1){d=S()>96;i=S()-(d?96:32) ;q++;if(p<b*5&&!S()){p+=b;  q=      0;}Z=1;}/*[[*/
  while(i){_=o[0][S()-97];I=_-10?b:1;   for( ;I--;)putchar(_ );if   (!      --i||d)z(~i );}
 if(p==b*5&&O){p-=b;O--;}}return 0U;   }if(! (P=( f*)calloc /*]*/  (Q        ,I)))return 1;
 {;}for(_=p=1;p<I;p++){e(q=1);while    (q<   p&&  strcmp(  l[p     ]         ,l[(q)]))++  q;
 t=stdin;if(q<p){(void)memcpy/* "      */    (&P  [p],&P   [q     ]          ,Q);continue ;}
if(strcmp(l[p],"-")){t=fopen(l         [     p]   ,"rb"   )                  ;if(!t ){{;}  ;
printf(05+*o,l[p ]);return+1;                      {;}                       }}_=b= 1<<16   ;
*&O=5;do{if(!(P[p].q=realloc   (P[p].q,(P[p].P     +=       b)+1))){return   01;}O   &=72   /
6/*][*/;P[p].o+=d=fread(P[p]      .q       +P[     p           ].       o,  1,b,t)   ;}//
 while(d==b)      ;P [p].q[       P[       p]                  .o       ]=  012;d    =0;
 e(fclose(t        )  );P         [p]      .p                  =P[      p]  .q;if    (O)
 {for(;d<P[            p]          .o     ;d=                   q+     1)    {q=     d;
  while(q<P[                        p].o&&P[                    p].q[q]-     10     ){
  q++;}b=q-d;                         _=P                         [p].        d     ;
  if(b>_){/*]b                                                                */
   P[p].d=b;}{;                                                                }
   #undef/*pqdz'.*/  e//                                                      ;
   #define/*s8qdb]*/e/**/0                                                   //
   //<<.<<.----.>.<<.>++.++<                                              .[>]
   /*P[*/P[p].b++;continue;}}}t=                                       stdout;
  for (p=1;p<I;p++){/**/if(P[p].b>i                               ){i=P[p].b;}}
 if  (O){for(p=0;p<i;p++){q=0;/*[*/while(I               >++q){_=P[q].p-P[q ].q;
b=   0;if(_<P[q ].o){while(012-*P[q].p)     {putchar(*(P[q].p++));b++;}P[q]. p++;
}   ;while (P[  q].d>b++)putchar(040);}             putchar(10);}return 0;}p   =1;
   for(;   p<I   ;p++)fwrite(P[p] .q,P[              p].o,1,t);return 0 ;}//
  #/*]     ]<.    [-]<[-]<[- ]<[    -]<               [-  ]<;*/elif  e    //b
 |(1        <<     ( __LINE__        /*               >>   `*//45))  |     01U
             #                       /*               */     endif            //


修改vim编辑器提示信息
vim /etc/vimrc

syntax on
"set paste 取消自动缩进,粘贴代码不乱换行
if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
hi comment ctermfg=6
  ntax on
▽et ignorecase
set autoindent 
"自动缩进,不过粘贴代码会自动换行
"set paste 取消自动缩进,粘贴代码不乱换行
"Paste toggle - when pasting something in, don't indent.按F3切换自动缩进和不自动缩进
set pastetoggle=<F3>
autocmd BufNewFile *.sh exec ":call SetTitle()"
func SetTitle()
        if expand("%:e") == 'sh'
        call setline(1,"#!/bin/bash")
        call setline(2,"#")
        call setline(3,"#********************************************************************")
        call setline(4,"#Author:                LH")
         call setline(5,"#QQ:                    501962149")
        call setline(6,"#Date:                  ".strftime("%Y-%m-%d"))
       call setline(7,"#FileName:             ".expand("%"))
         call setline(8,"#URL:                   https://blog.youkuaiyun.com/weixin_43551152")
         call setline(9,"#Description:          今晚打老虎")
         call setline(10,"#Copyright (C):        ".strftime("%Y")." All rights reserved")
        call setline(11,"#********************************************************************")
        call setline(12,"")
        endif
 endfunc
autocmd BufNewFile * normal G
   set fileencodings=ucs-bom,utf-8,latin1
endif

set nocompatible        " Use Vim defaults (much better!)
set bs=indent,eol,start         " allow backspacing over everything in insert mode
"set ai                 " always set autoindenting on
"set backup             " keep a backup file
set viminfo='20,\"50    " read/write a .viminfo file, don't store more
                        " than 50 lines of registers
set history=50          " keep 50 lines of command line history
set ruler               " show the cursor position all the time

" Only do this part when compiled with support for autocommands
if has("autocmd")
  augroup redhat
  autocmd!
  " In text files, always limit the width of text to 78 characters
  " autocmd BufRead *.txt set tw=78
  " When editing a file, always jump to the last cursor position
  autocmd BufReadPost *
"/etc/vimrc" 90L, 3209C written                                                                                                                          
[root@localhost wordpress]#vim /etc/vimrc
if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
hi comment ctermfg=6
syntax on
set ignorecase
set autoindent
"自动缩进,不过粘贴代码会自动换行
"set paste 取消自动缩进,粘贴代码不乱换行
"Paste toggle - when pasting something in, don't indent.按F3切换自动缩进和不自动缩进
set pastetoggle=<F3>
autocmd BufNewFile *.sh exec ":call SetTitle()"
func SetTitle()
        if expand("%:e") == 'sh'
        call setline(1,"#!/bin/bash")
        call setline(2,"#")
        call setline(3,"#********************************************************************")
        call setline(4,"#Author:                LH")
         call setline(5,"#QQ:                    501962149")
        call setline(6,"#Date:                  ".strftime("%Y-%m-%d"))
       call setline(7,"#FileName:             ".expand("%"))
         call setline(8,"#URL:                   https://blog.youkuaiyun.com/weixin_43551152")
         call setline(9,"#Description:          今晚打老虎")
         call setline(10,"#Copyright (C):        ".strftime("%Y")." All rights reserved")
        call setline(11,"#********************************************************************")
        call setline(12,"")
        endif
 endfunc
autocmd BufNewFile * normal G
   set fileencodings=ucs-bom,utf-8,latin1
endif

set nocompatible        " Use Vim defaults (much better!)
set bs=indent,eol,start         " allow backspacing over everything in insert mode
"set ai                 " always set autoindenting on
"set backup             " keep a backup file
set viminfo='20,\"50    " read/write a .viminfo file, don't store more
                        " than 50 lines of registers
set history=50          " keep 50 lines of command line history
set ruler               " show the cursor position all the time

" Only do this part when compiled with support for autocommands
if has("autocmd")
  augroup redhat
  autocmd!
  " In text files, always limit the width of text to 78 characters
  " autocmd BufRead *.txt set tw=78
  " When editing a file, always jump to the last cursor position
  autocmd BufReadPost *

指定yum源

ctneos7.5 yum源

  1. 将/etc/yum.repos.d/下的所有repo结尾的全移动到备份文件夹bak
  2. mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak
  3. yum install -y autofs #设置/misc/cd神奇目录自动挂载
  4. systemctl enable autofs #设置autofs服务开机启动
  5. vim /etc/yum.repos.d/Centos-7.5.repo
  6. 复制以下粘贴进去
[base]
name=base
baseurl=https://mirrors.aliyun.com/centos/7/os/x86_64/
gpgcheck=0

[updates]
name=updates
baseurl=https://mirrors.aliyun.com/centos/7/updates/x86_64/
gpgcheck=0

[extras]
name=extras
baseurl=https://mirrors.aliyun.com/centos/7/extras/x86_64/
gpgcheck=0

[epel]
name=epel
baseurl=https://mirrors.aliyun.com/epel/7/x86_64/
gpgcheck=0

修改ssh协议默认端口

vim /etc/ssh/sshd_config  
#Port 22 
Port 10086    #  修改默认端口   
systemctl restart sshd.service

安装命令自动补全工具

yum install bash-completion -y

安装上传下载工具

yum install lrzsz -y

安装防火墙

yum install firewalld
systemctl start firewalld

计划任务设置自动更新

yum -y install yum-cron    
vim /etc/yum/yum-cron.conf
apply_updates = yes   #no改为yes
systemctl start crond
systemctl start yum-cron  

最小化安装后安装基础命令包和开发工具

yum install gcc gcc-c++ glibc-devel pcre pcre-devel openssl openssl-devel systemd-devel net-tools vim iotop bc zip unzip zlib-devel lrzsz tree screen lsof tcpdump wget ntpdate bash-completion -y 

安装py3.6

yum install python36      
cd /usr/bin/      
rm python       
ln -s python3.6 python    
将yum的解析器改为Python2.7
vim /usr/bin/yum
#!/usr/bin/python2.7  #改第一行
vim /usr/libexec/urlgrabber-ext-down
#!/usr/bin/python2.7  #改第一行
 
yum install python36-pip          
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值