centos系统使用技巧

===============================网络配置===============================
1 eth0 接口配置:/etc/sysconfig/network-scipts/ifcfg-eth0
DEVICE=eth0
HWADDR=C8:60:00:69:CE:04
TYPE=Ethernet
UUID=ff105f76-baaa-4a8d-95c2-efe85fd9ab23
#接口随网络启动而自启动
ONBOOT=yes
NM_CONTROLLED=yes
#静态ip
BOOTPROTO=static
IPADDR=192.168.20.51
NETMASK=255.255.255.0
GATEWAY=192.168.20.254
#若无法解析域名,请配置DNS值
DNS1=202.96.128.86
DNS2=202.96.128.166
#PEERDNS=yes
2 DNS服务器配置: /etc/resolv.conf
nameserver 202.96.128.86
nameserver 202.96.128.166

================================vbox安装====================================
1 vim /etc/yum.repo.d/virtualbox.repo  添加如下行:
[virtualbox]
name=Oracle Linux / RHEL / CentOS-$releasever / $basearch - VirtualBox
baseurl=http://download.virtualbox.org/virtualbox/rpm/el/$releasever/$basearch
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://www.virtualbox.org/download/oracle_vbox.asc
2 yum install VirtualBox-5.0
3 yum install -y gcc kernel kernel-devel kernel-headers   // 查找kernel安装位置
4 重启电脑 // 或:KERN_DIR=/usr/src/kernels/2.6.32-573.22.1.el6.x86_64 /etc/init.d/vbox  // KERN_DIR填实际安装的位置

==================安装增强工具===================
1 sudo yum install kernel-devel gcc gcc-c++ make
2 sudo yum groupinstall “Deveplement Tools”
3 reboot
4 cd /media/VBOXADDITIONS_4.3.6_91406
5 export MAKE='/usr/bin/gmake -i'
6 ./VBoxLinuxAdditions.run

====================更新yum包源======================
1 wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
2 cd /etc/yum.repos.d/
3 mv CentOS-Base.repo CentOS-Base.repo.bak
4 mv CentOS6-Base-163.repo CentOS-Base.repo
5 yum clean all
6 yum makecache
7 yum update

 // 方式2: rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm

 ==============php源码安装============

 #yum install -y gcc gcc-c++  make zlib zlib-devel pcre pcre-devel  libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers
 yum install libxml2-devel.x86_64
 yum install  openssl.x86_64 openssl-devel.x86_64 -y
 yum install libcurl.x86_64 libcurl-devel.x86_64 -y
 yum install libjpeg.x86_64 libpng.x86_64 freetype.x86_64 libjpeg-devel.x86_64 libpng-devel.x86_64 freetype-devel.x86_64 -y
 yum install libjpeg.x86_64 libpng freetype libjpeg-devel libpng-devel freetype-devel -y
 yum install libmcrypt libmcrypt-devel -y
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir --with-freetype-dir=/usr/local/freetype --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-gettext --disable-fileinfo --enable-opcache --with-iconv=/usr/local
缺libconv库时,可源码安装该库到/usr/local(--with-iconv指定的位置,库地址:http://www.gnu.org/software/libiconv/)
 make && make install     // make 遇到错误可将/usr/local/lib 加入动态加载的配置文件/etc/ld.so.conf.d/xxx.conf
 cp php.ini-production /app/soft/php/lib/php.ini
 参考:http://www.cnblogs.com/z-ping/archive/2012/06/18/2553929.html
 php-fpm配置:http://www.cnblogs.com/argb/p/3604340.html



 ================composer安装====================
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
composer config -g secure-http false

原文地址:https://www.cnblogs.com/--xiaoyao--/p/5422139.html