1.准備工作
1
2
3
4
5
|
yum install vim<br>yum install wget
yum install make
yum
-
y install bzip2
yum install m4
yum install gcc gcc
-
c
+
+
glibc
-
static
-
y
/
/
安裝舊的gcc相關的編譯工具
|
2.下載gcc 4.8.2源代碼
1
|
wget http:
/
/
gcc.gnu.org
/
pub
/
gcc
/
releases
/
gcc
-
4.8
.
2
/
gcc
-
4.8
.
2.tar
.bz2
|
3.解壓縮源代碼包,進入gcc-4.8.2目錄,執行./contrib/download_prerequisities腳本會自動下載三個依賴庫別為gmp-4.3.2、mpfr-2.4.2、mpc-0.8.1
4.安裝gmp,mpfr,mpc
1
2
3
4
5
|
cd gmp
mkdir build
cd build
..
/
configure
-
-
prefix
=
/
usr
/
local
/
gcc
/
gmp
-
4.3
.
2
make && make install
|
1
2
3
4
5
|
cd ..
/
..
/
mpfr
mkdir build
cd build
..
/
configure
-
-
prefix
=
/
usr
/
local
/
gcc
/
mpfr
-
2.4
.
2
-
-
with
-
gmp
=
/
usr
/
local
/
gcc
/
gmp
-
4.3
.
2
make && make install
|
1
2
3
4
5
|
cd ..
/
..
/
mpc
mkdir build
cd build
..
/
configure
-
-
prefix
=
/
usr
/
local
/
gcc
/
mpc
-
0.8
.
1
-
-
with
-
mpfr
=
/
usr
/
local
/
gcc
/
mpfr
-
2.4
.
2
-
-
with
-
gmp
=
/
usr
/
local
/
gcc
/
gmp
-
4.3
.
2
make && make install
|
5.添加共享庫路徑
1
2
3
4
|
vim
/
etc
/
ld.so.conf
/
/
添加如下內容
/
usr
/
local
/
gcc
/
gmp
-
4.3
.
2
/
lib
/
usr
/
local
/
gcc
/
mpfr
-
2.4
.
2
/
lib
/
usr
/
local
/
gcc
/
mpc
-
0.8
.
1
/
lib<br>
/
/
保存退出,執行ldconfig<br>ldconfig
|
6.編譯GCC4.8.2
1
2
3
4
5
|
cd ..
/
..
mkdir build
cd build
..
/
configure
-
-
prefix
=
/
usr
/
local
/
gcc
-
-
enable
-
threads
=
posix
-
-
disable
-
checking
-
-
enable
-
languages
=
c,c
+
+
-
-
disable
-
multilib
make && make install
|
7.卸載舊版本
1
2
3
|
yum remove gcc
yum remove gcc
-
c
+
+
updatedb
|
8.安裝phpstudy
據說在centos-6.5,debian-7.4.,ubuntu-13.10測試成功。(可是也不來個詳細步驟,搗鼓了兩天,特喵的,成功了趕緊寫個博客記錄下來)
下載版:http://lamp.phpstudy.net/phpstudy.bin
完整版:http://lamp.phpstudy.net/phpstudy-all.bin
安裝:
wget -c http://lamp.phpstudy.net/phpstudy.bin
chmod +x phpstudy.bin #權限設置
./phpstudy.bin #運行安裝
經過前七步的鋪墊,很順利安裝成功了
如何切換php版:
再次運行./phpstudy.bin
9.配置apache
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
<Directory
"/phpstudy/www"
>
Options
+
Indexes
+
FollowSymLinks
+
ExecCGI
AllowOverride
All
Order allow,deny
Allow
from
all
Require
all
granted
<
/
Directory>
<Directory
/
>
Options
-
Indexes
+
FollowSymLinks
+
ExecCGI
AllowOverride
All
Order allow,deny
Allow
from
all
Require
all
granted
<
/
Directory>
|
安裝完ssh后,啟動服務
以特權模式運行容器
創建容器:
# docker run -d -name centos7 --privileged=true centos:7 /usr/sbin/init
進入容器:
# docker exec -it centos7 /bin/bash
這樣可以使用systemctl啟動服務了。