yum添加163源
地址:
http://mirrors.163.com/.help/centos.html
下載方式:
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
使用 yum 程序安裝所需開發包(以下為標准的rpm包名稱)
yum install gcc gcc-c++ gcc-g77 flex bison autoconf automake bzip2-devel
zlib-devel ncurses-devel libjpeg-devel libpng-devel libtiff-devel
freetype-devel pam-devel openssl-devel libxml2-devel gettext-devel pcre-devel mysql-devel net-snmp-devel
curl-devel perl-DBI
yum -y install mysql mysql-server
自啟動:
chkconfig --level 235 mysqld on
啟動服務:
/etc/init.d/mysqld start
配置mysql的密碼:
mysqladmin -u root password 123456 (自行修改!!)
mysql的配置文件:
/etc/my.cnf
yum -y install httpd
自啟動:
chkconfig --level 235 httpd on
啟動服務:
/etc/init.d/httpd start
apache的web存放目錄:
/var/www/html
apache的配置文件:
/etc/httpd/conf/httpd.conf
Listen 80
ServerName 127.0.0.1:80
DocumentRoot “/var/www/html”
DirectoryIndex index.php index.html index.html.var
yum -y install php
重啟httpd服務激活php:
/etc/init.d/httpd restart
測試php是否安裝完成
vim /var/www/html/info.php
<?php
phpinfo();
?>
搜索php組件:
yum search php
安裝常用組件:
yum -y install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml
php-xmlrpc php-bcmath php-mbstring
記得安裝完要重啟httpd服務激活組件:
/etc/init.d/httpd restart
php配置文件:
vi /etc/php.ini
memory_limit=128M
post_max_size=8M
upload_max_filesize=2M
一條命令安裝:
yum -y install gcc gcc-c++ gcc-g77 flex bison autoconf automake bzip2-devel zlib-devel ncurses-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel pam-devel openssl-devel libxml2-devel gettext-devel pcre-devel mysql-devel net-snmp-devel curl-devel perl-DBI mysql mysql-server httpd php php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-bcmath php-mbstring
然後配置 mysql密碼和更改apache配置文件即可。