Initial knowledge of the CentOS Service command Daquan

Source: Internet
Author: User
Tags i18n openssl version disk usage

(1) System Architecture

View Kernel

Shell Code
    1. # Uname-s-R
    2. Linux 2.6. 32-358.el6.x86_64



View Release version

Shell Code
    1. # Cat/etc/redhat-release
    2. CentOS Release 6.4 (Final)



View CPU Architecture

Shell Code
    1. # Arch
    2. x86_64 (x86_64 means 64-bit machine/i686 represents 32-bit machine)
    3. # getconf Long_bit
    4. -



(2) User Settings

Add user

Shell Code
    1. #/usr/sbin/useradd user1-d/home/user1-g Nobody
    2. # passwd User1
    3. New Password: 123456
    4. Retype new password: 123456
    5. Passwd:all authentication tokens updated successfully.



Confirm User

Shell Code
    1. # ID User1



Delete User

Shell Code
    1. # Userdel-r User1



Give root permission

Shell Code
    1. # Usermod-g Wheel Hoge
    2. # VI/ETC/PAM.D/SU
    3. Auth Required pam_wheel.so Use_uid # <= Uncomment



User List

Shell Code
    1. # CAT/ETC/PASSWD



(3) network Settings

Set IP

Shell Code
  1. # Vi/etc/sysconfig/network-scripts/ifcfg-eth0
  2. device="Eth0"
  3. otproto="Static" # <=
  4. Hwaddr="00:0c:29:53:a5:ae"
  5. ipv6init="No" # <=
  6. nm_controlled="Yes"
  7. onboot="Yes"
  8. Type="Ethernet"
  9. uuid="1ca6acf4-ebce-415a-a89b-bf89a67819ff"
  10. Ipaddr="xxx.xxx.xx.xx" # <=
  11. netmask="255.255.255.0" # <=
  12. gateway="xxx.xxx.xx.xx" # <=
  13. dns1="xxx.xxx.xx.xx" # <=
  14. # Service Network Restart
  15. Shutting down interface eth0:
  16. ......
  17. Connection activated [OK]
  18. # ifconfig
  19. Eth0 Link encap:ethernet HWaddr 00:0c:29:2f:d5:
  20. inet addr:xxx.xxx.xx.xx Bcast:xxx.xxx.xx.xx Mask:255.255. 255.0
  21. ......



Uninstalling the Nestworkmanager service

Shell Code
    1. # chkconfig NetworkManager off
    2. # yum-y Remove NetworkManager



Close IPv6

Shell Code
    1. # service ip6tables stop  
    2. # chkconfig  ip6tables off  
    3. # echo  Install ipv6 /bin/true "&NBSP;>>&NBSP;/ETC/MODPROBE.D/DISABLE-IPV6.CONF&NBSP;&NBSP;
    4. # vi /etc/ sysconfig/network  
    5.   networking_ipv6=no  
    6.   ipv6init= no  
    7. # vi /etc/sysconfig/network-scripts/ifcfg-eth0  
    8. #  shutdown -r now  
    9. # lsmod | grep ipv6   
    10.    no IPv6 module   
    11. # netstat -an | grep ffff  
    12.    not: FFFF: start of ip  
    13. # ifconfig  
    14.    No inet6 addr start text   



(4) package management settings

Yum cleanup

Shell Code
    1. # Yum Clean All
    2. Loaded Plugins:fastestmirror, security
    3. Cleaning Repos:base Extras Updates
    4. Cleaning up everything
    5. # yum Makecache
    6. Loaded Plugins:fastestmirror, security
    7. Determining fastest Mirrors
    8. .............
    9. Metadata Cache Created



Yum Update

Shell Code
    1. # yum-y Update



Automatic Updates

Shell Code
    1. # yum-y Install Yum-cron
    2. # Vi/etc/sysconfig/yum-cron
    3. Check_only=yes
    4. Download_only=yes
    5. #/etc/rc.d/init.d/yum-cron Start
    6. # Chkconfig Yum-cron on
    7. # chkconfig--list Yum-cron



Automatically find the fastest image

Shell Code
    1. # yum-y Install Yum-plugin-fastestmirror
    2. # vi/etc/yum/pluginconf.d/fastestmirror.conf
    3. enabled=0←0: Invalid 1: valid



Add Repository

Shell Code
  1. # Vi/etc/yum.repos.d/centos-base.repo
  2. # RPM-UVH http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5. 3-1.el6.rf.x86_64.rpm
  3. # Vi/etc/yum.repos.d/rpmforge.repo
  4. enabled=0
  5. # Yum--enablerepo=rpmforge install xxxx
  6. # RPM-UVH http://ftp.riken.jp/Linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
  7. # Vi/etc/yum.repos.d/epel.repo
  8. enabled=0
  9. # Yum--enablerepo=epel install xxxx



(5) Setting vim

Shell Code
    1. # yum-y Install vim-enhanced
    2. # Vi/etc/profile
    3. Alias vi=' vim '
    4. # Source/etc/profile
    5. # VI/ETC/VIMRC



(6) Security Settings

Turn off SELinux

Shell Code
    1. # Getenforce
    2. # Setenforce 0← temporarily closed
    3. # Vi/etc/sysconfig/selinux
    4. Selinux=enforcing
    5. Selinux=disabled



Stop Iptables

Shell Code
  1. #/etc/rc.d/init.d/iptables Stop
  2. iptables:flushing firewall rules: [OK]
  3. Iptables:setting chains to Policy Accept:filter [OK]
  4. iptables:unloading modules: [OK]
  5. # chkconfig Iptables off
  6. # chkconfig--list iptables
  7. Iptables 0:off 1:off 2:off 3:off 4:off 5:off 6:off



(7) operation of the system

Disk usage

Shell Code
    1. # df-h
    2. # yum-y Install Sysstat
    3. # Iostat



Memory usage

Shell Code
    1. # free-m



CPU and memory

Shell Code
    1. # Cat/proc/cpuinfo
    2. # Cat/proc/meminfo



(8) Other

Native language

Shell Code
    1. # yum-y Groupinstall "Japanese support"
    2. # vi/etc/sysconfig/i18n
    3. lang="en_US. UTF-8 "
    4. lang="JA_JP. UTF-8 "
    5. # source/etc/sysconfig/i18n
    6. # echo $LANG
    7. Ja_jp. utf-8
    8. # Shutdown-r Now



Stop unnecessary services

Shell Code
    1. # chkconfig--list | grep 3:on
    2. # Service Ip6tables Stop
    3. # chkconfig Ip6tables off



Encoding conversion NKF (Network Kanji Filter)

Shell Code
    1. # yum-y Install NKF
    2. # VI Readme.txt
    3. Test
    4. Kanji
    5. # nkf-g Readme.txt
    6. utf-8 (LF)
    7. # nkf-s--overwrite Readme.txt
    8. # nkf-g Readme.txt
    9. Shift_JIS (LF)
    10. # nkf-j--overwrite Readme.txt
    11. # nkf-g Readme.txt
    12. iso-2022-jp (LF)



Installing GCC

Shell Code
    1. # Rpm-qa GCC
    2. # yum-y Install gcc gcc-c++
    3. # gcc-v
    4. Using built-in specs.
    5. Target:i686-redhat-linux
    6. ............
    7. GCC version 4.4. 7 20120313 (Red Hat 4.4. 7-4) (GCC)



Installing Pcre

Shell Code
  1. # CD/USR/LOCAL/SRC
  2. # wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.35.tar.gz
  3. # tar zxvf pcre-8.35.tar.gz
  4. # cd/usr/local/src/pcre-8.35
  5. #./configure--prefix=/usr/local/pcre/8.35
  6. # Make Clean
  7. # Make && make install
  8. # path=/usr/local/pcre/8.35/bin: $PATH
  9. # vi/etc/ld.so.conf
  10. /usr/local/pcre/8.35/lib← End Append
  11. # Ldconfig
  12. # Rpm-qa Pcre
  13. pcre-7.8-6.el6.x86_64
  14. # pcretest-c
  15. PCRE version 7.8 2008-09-



Installing OpenSSL

Shell Code
  1. # CD/USR/LOCAL/SRC
  2. # wget http://www.openssl.org/source/openssl-1.0.1h.tar.gz
  3. # tar xzvf openssl-1.0.1h.tar.gz
  4. # CD openssl-1.0.1h
  5. #./config Shared-fpic
  6. # Make && make install
  7. # vi/etc/ld.so.conf
  8. /usr/local/ssl/lib← End Append
  9. # Ldconfig
  10. # ldconfig-f/etc/ld.so.conf-vp|grep Ssl/lib
  11. Libssl.so. 1.0.0 (LIBC6) =/usr/local/ssl/lib/libssl.so. 1.0.0
  12. Libssl.so (LIBC6) =/usr/local/ssl/lib/libssl.so
  13. Libcrypto.so. 1.0.0 (LIBC6) =/usr/local/ssl/lib/libcrypto.so. 1.0.0
  14. Libcrypto.so (LIBC6) =/usr/local/ssl/lib/libcrypto.so
  15. #/USR/LOCAL/SSL/BIN/OPENSSL Version
  16. OpenSSL 1.0.1h 5 June



NTP sync time

Reference # Yum-y Install NTP
# mv/etc/ntp.conf/etc/ntp.conf.org
# vi/etc/ntp.conf
Driftfile/var/lib/ntp/drift
Server 0.jp.pool.ntp.org
Server 1.jp.pool.ntp.org
Server 2.jp.pool.ntp.org
Server 3.jp.pool.ntp.org
# ntpdate 0.jp.pool.ntp.org
#/ETC/INIT.D/NTPD Start
# ntpq-p
# Ntpstatshell Code
      1. # Yum Update glibc
      2. # Rpm-qa | grep glibc
      3. 2.12-1.149.el6_6. 5

Initial knowledge of the CentOS Service command Daquan

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.