Get started with CentOS service commands

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

Get started with CentOS service commands
(1) System Architecture

View the kernel
Shell code

  1. # Uname-s-r
  2. Linux2.6.32-358. el6.x86 _ 64


View released versions
Shell code
  1. # Cat/etc/redhat-release
  2. CentOSrelease6.4 (Final)


View CPU architecture
Shell code
  1. # Arch
  2. X86_64 (x86_64 indicates 64-bit machines/i686 indicates 32-bit machines)
  3. # GetconfLONG_BIT
  4. 64


(2) user settings

Add User
Shell code
  1. #/Usr/sbin/useradduser1-d/home/user1-Gnobody
  2. # Passwduser1
  3. Newpassword: 123456.
  4. Retypenewpassword: 123456
  5. Passwd: allauthenticationtokensupdatedsuccessfully.


Confirm user
Shell code
  1. # Iduser1


Delete a user
Shell code
  1. # Userdel-ruser1


Grant root permission
Shell code
  1. # Usermod-Gwheelhoge
  2. # Vi/etc/pam. d/su
  3. Authrequiredpam_wheel.souse_uid # <= Cancel Annotation


User Overview
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. # Servicenetworkrestart
  15. Shuttingdowninterfaceeth0:
  16. ......
  17. Connectionactivated [OK]
  18. # Ifconfig
  19. Eth0Linkencap: EthernetHWaddr00: 0C: 29: 2F: D5: 58
  20. Inetaddr: xxx. xxx. xx. xxBcast: xxx. xxx. xx. xxMask: 255.255.255.0
  21. ......


Uninstall the NestworkManager Service
Shell code
  1. # ChkconfigNetworkManageroff
  2. # Yum-yremoveNetworkManager


Disable IPv6
Shell code
  1. # Serviceip6tablesstop
  2. # Chkconfigip6tablesoff
  3. # Echo "installipv6/bin/true">/etc/modprobe. d/disable-ipv6.conf
  4. # Vi/etc/sysconfig/network
  5. NETWORKING_IPV6 = no
  6. IPV6INIT = no
  7. # Vi/etc/sysconfig/network-scripts/ifcfg-eth0
  8. # Shutdown-rnow
  9. # Lsmod | grepipv6
  10. No ipv6 Module
  11. # Netstat-an | grepffff
  12. No: ffff: Starting IP Address
  13. # Ifconfig
  14. No text starting with inet6addr


(4) package management settings

Yum cleanup
Shell code
  1. # Yumcleanall
  2. Loadedplugins: fastestmirror, security
  3. Cleaningrepos: baseextrasupdates
  4. CleaningupEverything
  5. # Yummakecache
  6. Loadedplugins: fastestmirror, security
  7. Determiningfastestmirrors
  8. .............
  9. MetadataCacheCreated


Yum update
Shell code
  1. # Yum-yupdate


Automatic update
Shell code
  1. # Yum-yinstallyum-cron
  2. # Vi/etc/sysconfig/yum-cron
  3. CHECK_ONLY = yes
  4. DOWNLOAD_ONLY = yes
  5. #/Etc/rc. d/init. d/yum-cronstart
  6. # Chkconfigyum-cronon
  7. # Chkconfig -- listyum-cron


Automatically find the fastest Image
Shell code
  1. # Yum-yinstallyum-plugin-fastestmirror
  2. # Vi/etc/yum/pluginconf. d/fastestmirror. conf
  3. Enabled = 0 disabled 0: Invalid 1: VALID


Add repository
Shell code
  1. # Vi/etc/yum. repos. d/CentOS-Base.repo
  2. # Rpm-Uvhhttp: // 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 = rpmforgeinstallxxxx
  6. # Rpm-Uvhhttp: // 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 = epelinstallxxxx


(5) set vim
Shell code
  1. # Yum-yinstallvim-enhanced
  2. # Vi/etc/profile
  3. Aliasvi = 'vim'
  4. # Source/etc/profile
  5. # Vi/etc/vimrc


(6) Security Settings

Disable SELinux
Shell code
  1. # Getenforce
  2. # Setenforce0 disable temporarily
  3. # Vi/etc/sysconfig/selinux
  4. SELINUX = enforcing
  5. Bytes
  6. SELINUX = disabled


Stop iptables
Shell code
  1. #/Etc/rc. d/init. d/iptablesstop
  2. Iptables: Flushingfirewallrules: [OK]
  3. Iptables: SettingchainstopolicyACCEPT: filter [OK]
  4. Iptables: Unloadingmodules: [OK]
  5. # Chkconfigiptablesoff
  6. # Chkconfig -- listiptables
  7. Iptables0: off1: off2: off3: off4: off5: off6: off


(7) System Operation

Disk usage
Shell code
  1. # Df-h
  2. # Yum-yinstallsysstat
  3. # Iostat


Memory usage
Shell code
  1. # Free-m


CPU and memory
Shell code
  1. # Cat/proc/cpuinfo
  2. # Cat/proc/meminfo


(8) Others

Local Language
Shell code
  1. # Yum-ygroupinstall "JapaneseSupport"
  2. # Vi/etc/sysconfig/i18n
  3. LANG = "en_US.UTF-8"
  4. Bytes
  5. LANG = "ja_JP.UTF-8"
  6. # Source/etc/sysconfig/i18n
  7. # Echo $ LANG
  8. Ja_JP.UTF-8
  9. # Shutdown-rnow


Stop unnecessary services
Shell code
  1. # Chkconfig -- list | grep3: on
  2. # Serviceip6tablesstop
  3. # Chkconfigip6tablesoff


Network Kanji Filter)
Shell code
  1. # Yum-yinstallnkf
  2. #Vireadme.txt
  3. Test
  4. Character
  5. #Nkf-greadme.txt
  6. UTF-8 (LF)
  7. #Nkf-s--overwritereadme.txt
  8. #Nkf-greadme.txt
  9. Shift_JIS (LF)
  10. #Nkf-j--overwritereadme.txt
  11. #Nkf-greadme.txt
  12. ISO-2022-JP (LF)


Install gcc
Shell code
  1. # Rpm-qagcc
  2. # Yum-yinstallgccgcc-c ++
  3. # Gcc-v
  4. Usingbuilt-inspecs.
  5. Target: i686-redhat-linux
  6. ............
  7. Gccversion4.4.720120313 (RedHat4.4.7-4) (GCC)


Install PCRE
Shell code
  1. # Cd/usr/local/src
  2. # Wgetftp: // ftp. csx. cam. ac. uk/pub/software/programming/pcre/pcre-8.35.tar.gz
  3. #Tarzxvfpcre-8.35.tar.gz
  4. # Cd/usr/local/src/pcre-8.35
  5. #./Configure -- prefix =/usr/local/pcre/8.35
  6. # Makeclean
  7. # Make & makeinstall
  8. # PATH =/usr/local/pcre/8.35/bin: $ PATH
  9. # Vi/etc/ld. so. conf
  10. /Usr/local/pcre/8.35/lib merge appended at the end
  11. # Ldconfig
  12. # Rpm-qapre
  13. Pcre-7.8-6.el6.x86_64
  14. # Pcretest-C
  15. PCREversion7.82008-09-05


Install OpenSSL
Shell code
  1. # Cd/usr/local/src
  2. # Wgethttp: // www.openssl.org/source/openssl-1.0.1h.tar.gz
  3. #Tarxzvfopenssl-1.0.1h.tar.gz
  4. # Cdopenssl-1.0.1h
  5. #./Configshared-fPIC
  6. # Make & makeinstall
  7. # Vi/etc/ld. so. conf
  8. /Usr/local/ssl/lib labels appended at the end
  9. # Ldconfig
  10. # Ldconfig-f/etc/ld. so. conf-vp | grepssl/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/opensslversion
  16. OpenSSL1.0.1h5Jun2014


NTP synchronization 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. # Yumupdateglibc
  2. # Rpm-qa | grepglibc
  3. 2.12-1.149.el6 _ 6.5

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.