linux安裝freetype
⑴ linux6.5,LAMP環境都搭建好了進入頁面卻安裝不了,為什麼
1、確認搭建LAMP所需的環境是否已經安裝:
[root@localhost ~]#rpm -q make gcc gcc-c++ zlib-devel libtool libtool-ltdl libtool-ltdl-devel bisonncurses-devel
備注:安裝libpng時需要zlib-devel
安裝php時需要libtool、libtool-ltdl、libtool-ltdl-devel
安裝mysql時需要bison、ncurses-devel
2、如果沒安裝則yum安裝:
[root@localhost~]#yum -y install make gcc gcc-c++ zlib-devel libtool libtool-ltdllibtool-ltdl-devel bison ncurses-devel
3、由於要使用編譯安裝,所以查看httpd、mysql、php是否安裝:
[root@localhost ~]#rpm -q httpd mysql php
如果安裝則卸載:
[root@localhost ~]#rpm -e httpd --nodeps
[root@localhost ~]#rpm -e mysql --nodeps
[root@localhost ~]#rpm -e php --nodeps
編譯安裝過程介紹:
1)解壓tar.gz為後綴的壓縮軟體包:LAMP環境搭建所需要的每個軟體的軟代碼文激首件,都是以tar.gz或.tgz提供給我們的打包壓縮文件,所以我們必須將其解壓再解包。命令如下:
tar–zxvf *.tar.gz
2)在linux系統中源代碼包安裝過程:LAMP環境搭建所需要的軟體都是使用C語言明衡數開發的,所以安裝源代碼文件最少需要配置、編譯和安裝三個步驟
配置(configure)、編譯(make)、安裝(makeinstall)
4、編譯安裝libxml2
[root@localhostlinux]# tar -zxvf libxml2-2.6.30.tar.gz
[root@localhostlinux]# cd libxml2-2.6.30
[[email protected]]# ./configure --prefix=/usr/local/libxml2
[[email protected]]# make
[[email protected]]# make install
5、編譯安裝libmcrypt
[root@localhostlinux]# tar -zxvf libmcrypt-2.5.8.tar.gz
[root@localhostlinux]# cd libmcrypt-2.5.8
[[email protected]]# ./configure --prefix=/usr/local/libmcrypt
[[email protected]]# make
[[email protected]]# make install
6、編譯安裝zlib
[root@localhostlinux]# tar -zxvf zlib-1.2.3.tar.gz
[root@localhostlinux]# cd zlib-1.2.3
[[email protected]]# CFLAGS="-O3 -fPIC" ./configure --prefix=/usr/local/zlib/
(用64位元的方法進行編譯)
[[email protected]]# make
[[email protected]]# make install
7、編譯安裝libpng
[root@localhostlinux]# tar -zxvf libpng-1.2.31.tar.gz
[root@localhostlinux]# cd libpng-1.2.31
[[email protected]]# ./configure --prefix=/usr/攔鎮local/libpng \
>--enable-shared (建立共享庫使用的GNU的libtool)
[[email protected]]# make
[[email protected]]# make install
8、編譯安裝jpeg
[root@localhostlinux]# tar -zxvf jpegsrc.v6b.tar.gz
[root@localhostlinux]# cd jpeg-6b
[root@localhostjpeg-6b]# mkdir /usr/local/jpeg (創建jpeg軟體的安裝目錄)
[root@localhostjpeg-6b]# mkdir /usr/local/jpeg/bin (創建存放命令的目錄)
[root@localhostjpeg-6b]# mkdir /usr/local/jpeg/lib (創建jpeg庫文件所在目錄)
[root@localhostjpeg-6b]# mkdir /usr/local/jpeg/include (創建存放頭文件目錄)
[root@localhostjpeg-6b]# mkdir -p /usr/local/jpeg/man/man1 (建立存放手冊的目錄)
[root@localhostjpeg-6b]# ./configure --prefix=/usr/local/jpeg \
>--enable-shared \ (建立共享庫使用的GUN的libtool)
>--enable-static (建立靜態庫使用的GUN的libtool)
[root@localhostjpeg-6b]# make
[root@localhostjpeg-6b]# make install
執行make時如果出現如下錯誤:
./libtool --mode=compile gcc-O2 -I. -c ./jcapimin.c
make: ./libtool: Command notfound
make: *** [jcapimin.lo] Error 127
解決方法:
默認已安裝libtool及libtool-ltdl-devel(如需幫助請看過程2)
[root@localhostjpeg-6b]# find / -name config.sub
/usr/share/libtool/config/config.sub
[root@localhostjpeg-6b]# find / -name config.guess
/usr/share/libtool/config/config.guess
[root@localhostjpeg-6b]# cp -vRp /usr/share/libtool/config/config.sub .
[root@localhostjpeg-6b]# cp -vRp /usr/share/libtool/config/config.guess .
也就是把libtool裡面的兩個配置文件拿來覆蓋掉jpeg-6b目錄下的對應文件
make clean 再重新configure
9、編譯安裝freetype
[root@localhostlinux]# tar -zxvf freetype-2.3.5.tar.gz
[root@localhostlinux]# cd freetype-2.3.5
[[email protected]]# ./configure --prefix=/usr/local/freetype \
>--enable-shared (建立共享庫使用的GUN的libtool)
[[email protected]]# make
[[email protected]]# make install
10、編譯安裝autoconf
[root@localhostlinux]# tar -zxvf autoconf-2.61.tar.gz
[root@localhostlinux]# cd autoconf-2.61
[[email protected]]# ./configure
[[email protected]]# make
[[email protected]]# make install
11、編譯安裝GD
[root@localhostlinux]# tar -zxvf gd-2.0.35.tar.gz
[root@localhostlinux]# cd gd-2.0.35
[[email protected]]# ./configure --prefix=/usr/local/gd \
>--with-zlib=/usr/local/zlib/ \ (指定zlib庫文件的位置)
>--with-jpeg=/usr/local/jpeg/ \ (指定jpeg庫文件的位置)
>--with-png=/usr/local/libpng/ \ (指定png庫文件的位置)
>--with-freetype=/usr/local/freetype/ (指定freetype字體庫的位置)
[[email protected]]# make
[[email protected]]# make install
執行make時如果出現如下錯誤:
make[2]: *** [gd_png.lo] Error 1
make[2]: Leaving directory`/usr/src/linux/gd-2.0.35'
make[1]: *** [all-recursive]Error 1
make[1]: Leaving directory`/usr/src/linux/gd-2.0.35'
make: *** [all] Error 2
解決方法:
[[email protected]]# find / -name gd_png.c
/usr/src/linux/gd-2.0.35/gd_png.c
[[email protected]]# find / -name png.h
/usr/local/libpng/include/png.h
[[email protected]]# vi /usr/src/linux/gd-2.0.35/gd_png.c
將#include "png.h"
改為#include "/usr/local/libpng/include/png.h"
12、編譯安裝apache
[root@localhostlinux]# tar -zxvf httpd-2.2.9.tar.gz
[root@localhostlinux]# cd httpd-2.2.9
[[email protected]]# ./configure --prefix=/usr/local/apache \
> --enable-so \ (以動態共享對象編譯)
>--enable-rewrite (基於規則的URL操控)
[[email protected]]# make
[[email protected]]# make install
將apache加入開機啟動↓
[[email protected]]# cp -vRp /usr/local/apache/bin/apachectl /etc/init.d/httpd
[[email protected]]# chmod +x /etc/init.d/httpd
添加apache服務↓
[[email protected]]# chkconfig --add httpd
[[email protected]]# chkconfig --level 2345 httpd on
[[email protected]]# service httpd start
啟動服務時,如果出現如下錯誤:
httpd: Could not reliablydetermine the server's fully qualified domain name, using localhost.localdomainfor ServerName
解決方法:
[[email protected]]# vi /usr/local/apache/conf/httpd.conf
添加上:ServerName localhost:80
執行chkconfig時,如果出現如下錯誤:
service httpd does not supportchkconfig
解決方法:
[[email protected]]# vi /etc/rc.d/init.d/httpd
在文件第二行加入
#chkconfig:2345 10 90
#description:Activates/DeactivatesApache Web Server
保存後再執行chkconfig
13、編譯安裝mysql(最新版本都需要cmake編譯安裝)
編譯安裝 cmake
[root@localhostlinux]# tar -zxvf cmake-2.8.7.tar.gz
[root@localhostlinux]# cd cmake-2.8.7
[[email protected]]# ./bootstrap
[[email protected]]# gmake
[[email protected]]# gmake install
編譯安裝 MySQL5.5.20
[[email protected]]# groupadd mysql
[[email protected]]# useradd -g mysql mysql
[root@localhostlinux]# tar -zxvf mysql-5.5.15.tar.gz
[root@localhostlinux]# cd mysql-5.5.15
[[email protected]]#
cmake-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ (安裝根目錄)
> -DMYSQL_UNIX_ADDR=/usr/local/mysql/data/mysql.sock \ (UNIX socket文件)
>-DDEFAULT_CHARSET=utf8 \ (默認字元集)
>-DDEFAULT_COLLATION=utf8_general_ci \ (默認編碼)
>-DWITH_EXTRA_CHARSETS=utf8,gbk \ (額外的編碼)
>-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \(啟用PERFSCHEMA引擎支持)
>-DWITH_FEDERATED_STORAGE_ENGINE=1 \ (啟用FEDERATED引擎支持)
> -DWITH_PARTITION_STORAGE_ENGINE=1\ (啟用PARTITION引擎支持)
>-DWITH_ARCHIVE_STORAGE_ENGINE=1 \ (啟用ARCHIVE引擎支持)
>-DWITH_READLINE=1 \(使用readline功能)
>-DMYSQL_DATADIR=/usr/local/mysql/data \ (資料庫數據目錄)
>-DMYSQL_TCP_PORT=3306 (TCP/IP埠)
[[email protected]]# make
[[email protected]]# make install
[[email protected]]# cp -vRp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf
修改配置文件↓
[[email protected]]# vi /etc/my.cnf
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
log-error=/usr/local/mysql/data/error.log
pid-file=/usr/local/mysql/data/mysql.pid
初始化資料庫文件↓
[[email protected]]# /usr/local/mysql/scripts/mysql_install_db \
>--defaults-flie=/etc/my.cnf \
> --basedir=/usr/local/mysql/\
>--datadir=/usr/local/mysql/data \
>--pid-file=/usr/local/mysql/data/mysql.pid \
> --user=mysql
許可權設置↓
[root@localhostmysql]# chown -R root .
[root@localhostmysql]# chown -R mysql data
[root@localhostmysql]# chgrp -R mysql .
將mysql加入開機啟動↓
[root@localhostmysql]# cp -vRp support-files/mysql.server /etc/init.d/mysqld
[root@localhostmysql]# chmod +x /etc/init.d/mysqld
添加mysql服務↓
[root@localhostmysql]# chkconfig --add mysqld
[root@localhostmysql]# chkconfig --level 345 mysqld on
[root@localhostmysql]# service mysqld start
配置mysql↓
[root@localhostmysql]# bin/mysql
mysql> deletefrom mysql.user where Host!='localhost'; (只留允許本機登錄的帳號)
mysql> flushprivileges; (刷新授權表)
mysql> setpassword for 'root'@'localhost'=password('123456'); (設置用戶密碼)
mysql> exit
[root@localhostmysql]# bin/mysql -h localhost -u root -p123456 (登錄mysql)
14、編譯安裝php
[root@localhostlinux]# tar -zxvf php-5.3.19.tar.gz
[root@localhostlinux]# cd php-5.3.19
[[email protected]]# ./configure --prefix=/usr/local/php \
>--with-apxs2=/usr/local/apache/bin/apxs \
>--with-mysql=/usr/local/mysql/ \
>--with-libxml-dir=/usr/local/libxml2/ \
>--with-png-dir=/usr/local/libpng/ \
>--with-jpeg-dir=/usr/local/jpeg/ \
>--with-freetype-dir=/usr/local/freetype/ \
> --with-gd=/usr/local/gd/\
>--with-mcrypt=/usr/local/libmcrypt/ \
>--with-mysqli=/usr/local/mysql/bin/mysql_config \
> --enable-soap\ (變數激活SOAP和web services支持)
>--enable-mbstring=all \ (使多位元組字元串支持)
>--enable-sockets (變數激活socket通訊特性)
[[email protected]]# make
[[email protected]]# make install
[[email protected]]# cp -vRp php.ini-development /etc/php.ini
[[email protected]]# vi /usr/local/apache/conf/httpd.conf
添加上:
AddType application/x-httpd-php .php
[[email protected]]# service httpd stop
[[email protected]]# service httpd start
[[email protected]]# vi /usr/local/apache/htdocs/phpinfo.php
添加內容為:
<?php
phpinfo();
?>
打開瀏覽器進行訪問,如果出現PHP版本界面,及安裝成功。
⑵ 如何在linux下安裝多個不同版本的PHP
Linux (測試環境 Ubuntu 12.04 Server X86_64)
1. 安裝編譯工具及所需類庫
$ sudo apt-get install build-essential gcc g++ autoconf libjpeg62 libjpeg62-dev libpng12-0 libpng12-dev libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev bzip2 libbz2-dev openssl libssl-dev curl libcurl4-openssl-dev libpcre3 libpcre3-dev libevent-1.4-2 libevent-dev libmcrypt4 libmcrypt-dev mcrypt libltdl-dev libldap2-dev libsasl2-dev libmhash-dev libc-client2007e libc-client2007e-dev
2. 安裝MySQL
$ sudo apt-get install mysql-server libmysqlclient-dev
3. 安裝PHP
Linux下多版本PHP共存需要自己手工編譯安裝。
下載PHP源文件到/opt/src目錄
$ mkdir /opt/src
$ cd /opt/src
$ wget http://museum.php.net/php5/php-5.2.17.tar.bz2 -O php-5.2.17.tar.bz2
$ wget http://cn2.php.net/get/php-5.3.28.tar.bz2/from/this/mirror -O php-5.3.28.tar.bz2
$ wget http://cn2.php.net/get/php-5.4.29.tar.bz2/from/this/mirror -O php-5.4.29.tar.bz2
$ wget http://cn2.php.net/get/php-5.5.14.tar.bz2/from/this/mirror -O php-5.5.14.tar.bz2
創建PHP各版本安裝目錄
$ mkdir -p /opt/php/{5217,5328,5429,5514}
安裝PHP 5.2.17
$ cd /opt/src
$ tar -xvjf php-5.2.17.tar.bz2
$ cd php-5.2.17
$ sudo ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib/libjpeg.so
$ sudo ln -s /usr/lib/x86_64-linux-gnu/libpng.so /usr/lib/libpng.so
$ sudo ln -s /usr/lib/x86_64-linux-gnu/libkrb5.so /usr/lib/libkrb5.so
$ wget -O debian_patches_disable_SSLv2_for_openssl_1_0_0.patch 「https://bugs.php.net/patch-display.php?bug_id=54736&patch=debian_patches...」
$ patch -p1 < debian_patches_disable_SSLv2_for_openssl_1_0_0.patch
$ ./configure --prefix=/opt/php/5217 --with-config-file-scan-dir=/opt/php/5217/etc/php.d --with-mysql --with-pdo-mysql --with-mysqli --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-ftp --disable-debug --disable-ipv6 --disable-short-tags --enable-calendar --with-mime-magic --with-imap --with-imap-ssl --with-kerberos
$ make
$ sudo make install
$ cp php.ini-recommended /opt/php/5217/lib/php.ini
安裝PHP 5.3.28
$ cd /opt/src
$ tar -xvjf php-5.3.28.tar.bz2
$ cd php-5.3.28
$ ./configure --prefix=/opt/php/5328 --with-config-file-scan-dir=/opt/php/5328/etc/php.d --with-mysql --with-pdo-mysql --with-mysqli --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-ftp --disable-debug --disable-ipv6 --disable-short-tags --enable-calendar --with-imap --with-imap-ssl --with-kerberos
$ make
$ sudo make install
$ cp php.ini-development /opt/php/5328/lib/php.ini
安裝PHP 5.4.29
$ cd /opt/src
$ tar -xvjf php-5.4.29.tar.bz2
$ cd php-5.4.29
$ ./configure --prefix=/opt/php/5429 --with-config-file-scan-dir=/opt/php/5429/etc/php.d --with-mysql --with-pdo-mysql --with-mysqli --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-ftp --disable-debug --disable-ipv6 --disable-short-tags --enable-calendar --with-imap --with-imap-ssl --with-kerberos
$ make
$ sudo make install
$ cp php.ini-development /opt/php/5429/lib/php.ini
安裝PHP 5.5.14
$ cd /opt/src
$ tar -xvjf php-5.5.14.tar.bz2
$ cd php-5.5.14
$ ./configure --prefix=/opt/php/5514 --with-config-file-scan-dir=/opt/php/5514/etc/php.d --with-mysql --with-pdo-mysql --with-mysqli --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-ftp --disable-debug --disable-ipv6 --disable-short-tags --enable-calendar --with-imap --with-imap-ssl --with-kerberos
$ make
$ sudo make install
$ cp php.ini-development /opt/php/5514/lib/php.ini
4. 安裝Apache
$ sudo apt-get install apache2
啟用相應模塊
$ a2enmod headers
$ a2enmod expires
$ a2enmod actions
$ a2enmod rewrite
5. 配置Apache
$ sudo vi /etc/apache2/httpd.conf
追加如下腳本映射和虛擬主機配置,原理同Windows的配置說明。
ServerName localhost
AddType application/x-httpd-php .php
ScriptAlias /php-5217/ "/opt/php/5217/bin/"
ScriptAlias /php-5328/ "/opt/php/5328/bin/"
ScriptAlias /php-5429/ "/opt/php/5429/bin/"
ScriptAlias /php-5514/ "/opt/php/5514/bin/"
<Directory /var/www/sites>
Options Indexes FollowSymLinks Includes ExecCGI
DirectoryIndex index.php index.html
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<Directory /var/www/sites/5217>
Action application/x-httpd-php "/php-5217/php-cgi"
</Directory>
<Directory /var/www/sites/5328>
Action application/x-httpd-php "/php-5328/php-cgi"
</Directory>
<Directory /var/www/sites/5429>
Action application/x-httpd-php "/php-5429/php-cgi"
</Directory>
<Directory /var/www/sites/5514>
Action application/x-httpd-php "/php-5514/php-cgi"
</Directory>
# Virtualhosts
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/var/www/sites/5217/test.local"
ServerName php5217.local
ErrorLog "/var/log/apache2/php5217.local-error.log"
CustomLog "/var/log/apache2/php5217.local-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/var/www/sites/5328/test.local"
ServerName php5328.local
ErrorLog "/var/log/apache2/php5328.local-error.log"
CustomLog "/var/log/apache2/php5328.local-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/var/www/sites/5429/test.local"
ServerName php5429.local
ErrorLog "/var/log/apache2/php5429.local-error.log"
CustomLog "/var/log/apache2/php5429.local-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/var/www/sites/5514/test.local"
ServerName php5514.local
ErrorLog "/var/log/apache2/php5514.local-error.log"
CustomLog "/var/log/apache2/php5514.local-access.log" common
</VirtualHost>
保存配置後,創建各站點的DocumentRoot目錄,再往每個目錄放置一個phpinfo的測試文件,完成後重啟Apache伺服器並在本地hosts文件加入域名解析,現在就可以訪問各站點來測試多版本PHP共存了。
好了,基本的多版本PHP共存解決方案已經完成,如果還需要添加其他的PHP類庫支持,後續自己再調用對應php目錄下的pecl, php_config等腳本編譯安裝就可以了。
⑶ Linux安裝apxs
1、 安裝准備
#更新系統
yum -y update
#然後安裝相關的編譯器和必備的軟體
yum -y install bison pkgconfig glib2-devel gettext make libpng-devel libjpeg-devel libtiff-devel libexif-devel giflib-devel libX11-devel freetype-devel fontconfig-devel cairo-devel libtiff libtiff-devel libjpeg libjpeg-devel giflib giflib-devel libpng libpng-devel libX11 libX11-devel freetype freetype-devel fontconfig fontconfig-devel libexif libexif-devel libXft-devel ghostscript-devel gnome-doc-utils unzip
2 、下載安裝所需要的軟體包
統一下載到/usr/local/src下
wget http://download.mono-project.com/sources/libgdiplus/libgdiplus-2.10.tar.bz2
wget http://download.mono-project.com/sources/mono/mono-2.10.8.tar.bz2
wget http://download.mono-project.com/sources/xsp/xsp-2.10.tar.bz2
wget http://download.mono-project.com/sources/mod_mono/mod_mono-2.10.tar.bz2
wget http://apache.fayea.com/apache-mirror//httpd/httpd-2.2.27.tar.gz
3.安裝libgdiplus
libgdiplus是mono中的System.Drawing依賴的一個組件,用於顯示web頁面基本顏色等。
cd /usr/local/src
tar -xjvf libgdiplus-2.10.tar.bz2
cd libgdiplus-2.10
./configure --prefix=/usr/local
make
make install
4.安裝mono
cd /usr/local/src
tar -xjvf mono-2.10.8.tar.bz2
cd mono-2.10.8
./configure --prefix=/usr/local
make
make install
Mono安裝完成之後,可以用命令mono -V查看一下mono的安裝情況,如果能夠看到mono版本號等信息,說明Mono安裝成功。
5.安裝apache
cd /usr/local/src
tar -zxvf httpd-2.2.27.tar.gz
cd httpd-2.2.27
./configure --prefix=/usr/local/apache --enable-mods-shared=most
make
make install
6.安裝mod_mono
cd /usr/local/src
tar -xjvf mod_mono-2.10.tar.bz2
cd mod_mono-2.10
./configure
make
make install
7.安裝xsp
xsp就是mod-mono-server。
安裝之前,先設置一下環境變數
vi /etc/profile #在最後加上下面這句
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
source /etc/profile 或者注銷重新登陸一下
cd /usr/local/src
tar -xjvf xsp-2.10.2.tar.bz2
cd xsp-2.10.2
./configure --prefix=/usr/local
make
make install
8.配置apache
打開/usr/local/apache/conf文件夾中的httpd.conf,這個文件是apache的配置文件,在最後添加
Include /usr/local/apache/conf/mod_mono.conf
將以下#注釋去掉
#ServerName www.example.com:80
在/usr/local/apache/htdocs文件夾中任意創建一個index.aspx文件,添加內容如下
<%@ Page Language="C#" %>
<html>
<head>
<title>hello world</title>
</head>
<body>
<%
for (int i=1; i<=7; i++)
{
Response.Write("<font size=" + i.ToString() + ">");
Response.Write("hello world");
Response.Write("</font><br />");
}
%>
</body>
</html>
當然,你也可以網路,去下載一個asp.net探針
重啟apache
/usr/local/apache/bin/apachectl restart
通過瀏覽器訪問http://IP/index.aspx,測試asp.net環境搭建是否成功,如果返回「hello world」 說明安裝成功
⑷ linux 怎麼安裝nginx
Centos7配置Nginx+PHP7Web服務
作者:JadeGlorious
1、安裝相應的擴展支持;
yuminstallgcc-c++
yuminstallpcrepcre-devel
yuminstallzlibzlib-devel
yuminstallopensslopenssl-devel
yum-yinstalllibjpeglibjpeg-devellibpnglibpng-develfreetypefreetype-devellibxml2libxml2-develmysqlpcre-devel
yum-yinstallcurl-devellibxslt-devel
集成至一行命令一次安裝
yum-yinstalllibjpeglibjpeg-devellibpnglibpng-develfreetypefreetype-devellibxml2libxml2-develmysqlpcre-develgcc-c++pcrepcre-develpcrepcre-developensslopenssl--develcurl-devellibxslt-devel
如有不能成功安裝的,單獨再安裝一次即可;
2、編譯安裝Nginx最新版本
//檢查是否已經安裝nginx
$find/-namenginx
//如果已經安裝nginx先卸載掉
$yumremovenginx
//進入習慣使用的下載目錄,下載想要使用的nginx版
$wgethttp://nginx.org/download/nginx-1.7.4.tar.gz
//解壓nginx安裝包
$tar-zxvfnginx-1.7.4.tar.gz
//進入解壓後的目錄
$cdnginx-1.7.4
//配置安裝信息,要載入什麼擴展,安裝到什麼目錄之類的
//使用--prefix參數指定nginx安裝的目錄,make、makeinstall安裝
$./configure$默認安裝在下載目錄
//指定目錄
$./configure--prefix=/usr/local/nginx//指定安裝在/usr/local/nginx
//編譯安裝
$make&&makeinstall
//檢查是否安裝成功
$whereisnginx
3、編譯安裝PHP7
//下載、解壓、進入目錄:
$wgethttp://downloads.php.net/~ab/php-7.0.6RC1.tar.gz
$tar-zxvfphp-7.0.6RC1.tar.gz$cdphp-7.0.6RC1
//配置安裝信息、擴展
$./configure--prefix=/usr/local/php--exec-prefix=/usr/local/php--bindir=/usr/local/php/bin--sbindir=/usr/local/php/sbin--includedir=/usr/local/php/include--libdir=/usr/local/php/lib/php--mandir=/usr/local/php/php/man--with-config-file-path=/usr/local/php/etc--with-mysql-sock=/var/run/mysql/mysql.sock--with-mhash--with-openssl--with-mysql=shared,mysqlnd--with-mysqli=shared,mysqlnd--with-pdo-mysql=shared,mysqlnd--with-gd--with-iconv--with-zlib--enable-zip--enable-inline-optimization--disable-debug--disable-rpath--enable-shared--enable-xml--enable-bcmath--enable-shmop--enable-sysvsem--enable-mbregex--enable-mbstring--enable-ftp--enable-gd-native-ttf--enable-pcntl--enable-sockets--with-xmlrpc--enable-soap--without-pear--with-gettext--enable-session--with-curl--with-jpeg-dir--with-freetype-dir--enable-opcache--enable-fpm--enable-fastcgi--with-fpm-user=nginx--with-fpm-group=nginx--without-gdbm--disable-fileinfo
//編譯檢查不通過,缺少什麼擴展安裝了重新檢測,通過後編譯安裝
$makeclean&&make&&makeinstall
maketest
配置文件
#cpphp.ini-development/usr/local/php/lib/php.ini
#cp/usr/local/php/etc/php-fpm.conf.default/usr/local/php/etc/php-fpm.conf
#cp/usr/local/php/etc/php-fpm.d/www.conf.default/usr/local/php/etc/php-fpm.d/www.conf#cp-R./sapi/fpm/php-fpm/etc/init.d/php-fpm
//安裝完成後修改nginx配置文件nginx.conf,添加對php的支持,指定項目目錄,完成後重啟nginx
//啟動php-fpm
#/etc/init.d/php-fpm
⑸ Linux CentOS安裝PHP多版本同時運行
mkdir -p /lnmp/php74
wget https://www.php.net/distributions/php-7.4.33.tar.gz
tar -zxvf php-7.4.33
cd ./php-7.4.33
./configure --prefix=/lnmp/php74 --enable-fpm --with-mysqli --with-curl --with-pdo_mysql --with-pdo_sqlite --enable-mysqlnd --enable-mbstring --with-gd --with-freetype
(7.4之前的版本freetype是 --with-freetype-dir )
make
make install
cp php.ini-development /lnmp/php74/lib/php.ini
cd /lnmp/php74/etc
mv php-fpm.conf.default php-fpm.conf
mv php-fpm.d/www.conf.default php-fpm.d/www.conf
cd /lnmp/php71/etc/php-fpm.d
vim www.conf
cgi.fix_pathinfo=0
/lnmp/php71/sbin/php-fpm
ps aux|grep php
vim /etc/init.d/php71-fpm
chmod a+x /etc/init.d/php71-fpm
chkconfig --add php71-fpm
service php71-fpm start
service php71-fpm restar
service php71-fpm stop
⑹ linuxphp網站怎麼安裝
配置php服務
安飢塌裝yasm匯編器(解壓與編譯過程已省略):
[[email protected]]cd/usr/local/src
[root@linuxprobesrc]tarzxvfyasm-1.2.0.tar.gz
[root@linuxprobesrc]cdyasm-1.2.0
[[email protected]]./configure
[[email protected]]make
[[email protected]]makeinstall
安裝libmcrypt加密演算法擴展庫(解爛銀圓壓與編譯過程已省略):
[[email protected]]cd/usr/local/src
[root@linuxprobesrc]tarzxvflibmcrypt-2.5.8.tar.gz
[root@linuxprobesrc]cdlibmcrypt-2.5.8
[[email protected]]./configure
[[email protected]]make
[[email protected]]makeinstall
安裝libvpx視頻編碼器(解壓與編譯過程搏旦已省略):
[[email protected]]cd/usr/local/src
[root@linuxprobesrc]tarxjvflibvpx-v1.3.0.tar.bz2
[root@linuxprobesrc]cdlibvpx-v1.3.0
[[email protected]]./configure--prefix=/usr/local/libvpx--enable-shared--enable-vp9
[[email protected]]make
[[email protected]]makeinstall
安裝Tiff標簽圖像文件格式(解壓與編譯過程已省略):
[[email protected]]cd/usr/local/src
[root@linuxprobesrc]tarzxvftiff-4.0.3.tar.gz
[root@linuxprobesrc]cdtiff-4.0.3
[[email protected]]./configure--prefix=/usr/local/tiff--enable-shared
[[email protected]]make
[[email protected]]makeinstall
安裝libpng圖片(png格式)函數庫(解壓與編譯過程已省略):
[[email protected]]cd/usr/local/src
[root@linuxprobesrc]tarzxvflibpng-1.6.12.tar.gz
[root@linuxprobesrc]cdlibpng-1.6.12
[[email protected]]./configure--prefix=/usr/local/libpng--enable-shared
[[email protected]]make
[[email protected]]makeinstall
安裝freetype字體引擎(解壓與編譯過程已省略):
[[email protected]]cd/usr/local/src
[root@linuxprobesrc]tarzxvffreetype-2.5.3.tar.gz
[root@linuxprobesrc]cdfreetype-2.5.3
[[email protected]]./configure--prefix=/usr/local/freetype--enable-shared
[[email protected]]make
[[email protected]]makeinstall
安裝jpeg圖片(jpeg格式)函數庫(解壓與編譯過程已省略):
[[email protected]]cd/usr/local/src
[root@linuxprobesrc]tarzxvfjpegsrc.v9a.tar.gz
[root@linuxprobesrc]cdjpeg-9a
[root@linuxprobejpeg-9a]./configure--prefix=/usr/local/jpeg--enable-shared
[root@linuxprobejpeg-9a]make
[root@linuxprobejpeg-9a]makeinstall
安裝libgd圖像處理程序(解壓與編譯過程已省略):
[root@linuxprobejpeg-9a]cd/usr/local/src
[root@linuxprobesrc]tarzxvflibgd-2.1.0.tar.gz
[root@linuxprobesrc]cdlibgd-2.1.0
[[email protected]]./configure--prefix=/usr/local/libgd--enable-shared--with-jpeg=/usr/local/jpeg--with-png=/usr/local/libpng--with-freetype=/usr/local/freetype--with-fontconfig=/usr/local/freetype--with-xpm=/usr/--with-tiff=/usr/local/tiff--with-vpx=/usr/local/libvpx
[[email protected]]make
[[email protected]]makeinstall
安裝t1lib圖片生成函數庫(解壓與編譯過程已省略):
[[email protected]]cd/usr/local/src
[root@linuxprobesrc]tarzxvft1lib-5.1.2.tar.gz
[root@linuxprobesrc]cdt1lib-5.1.2
[[email protected]]./configure--prefix=/usr/local/t1lib--enable-shared
[[email protected]]make
[[email protected]]makeinstall
將函數庫文件放至合適的位置:
[[email protected]]cd/usr/local/src
[root@linuxprobesrc]ln-s/usr/lib64/libltdl.so/usr/lib/libltdl.so
[root@linuxprobesrc]cp-frp/usr/lib64/libXpm.so*/usr/lib/
安裝php服務程序(命令比較長,請一定要復制完整!!!):
[root@linuxprobesrc]tar-zvxfphp-5.5.14.tar.gz
[root@linuxprobesrc]cdphp-5.5.14
[[email protected]]exportLD_LIBRARY_PATH=/usr/local/libgd/lib
[[email protected]]./configure--prefix=/usr/local/php--with-config-file-path=/usr/local/php/etc--with-mysql=/usr/local/mysql--with-mysqli=/usr/local/mysql/bin/mysql_config--with-mysql-sock=/tmp/mysql.sock--with-pdo-mysql=/usr/local/mysql--with-gd--with-png-dir=/usr/local/libpng--with-jpeg-dir=/usr/local/jpeg--with-freetype-dir=/usr/local/freetype--with-xpm-dir=/usr/--with-vpx-dir=/usr/local/libvpx/--with-zlib-dir=/usr/local/zlib--with-t1lib=/usr/local/t1lib--with-iconv--enable-libxml--enable-xml--enable-bcmath--enable-shmop--enable-sysvsem--enable-inline-optimization--enable-opcache--enable-mbregex--enable-fpm--enable-mbstring--enable-ftp--enable-gd-native-ttf--with-openssl--enable-pcntl--enable-sockets--with-xmlrpc--enable-zip--enable-soap--without-pear--with-gettext--enable-session--with-mcrypt--with-curl--enable-ctype
[[email protected]]make
[[email protected]]makeinstall
復制php服務程序的配置文件到安裝目錄:
[[email protected]]cpphp.ini-proction/usr/local/php/etc/php.ini
刪除默認的php配置文件:
[[email protected]]rm-rf/etc/php.ini
創建php配置文件的軟連接到/etc/目錄中:
[[email protected]]cp/usr/local/php/etc/php-fpm.conf.default/usr/local/php/etc/php-fpm.conf
[[email protected]]ln-s/usr/local/php/etc/php-fpm.conf/etc/php-fpm.conf
[[email protected]]ln-s/usr/local/php/etc/php.ini/etc/php.ini
編輯php服務程序的配置文件:
[[email protected]]vim/usr/local/php/etc/php-fpm.conf
//將第25行參數前面的分號去掉。
pid=run/php-fpm.pid
//修改第148和149行,將user與group修改為www。
user=www
group=www
添加php-fpm服務程序到開機啟動項:
[[email protected]]cpsapi/fpm/init.d.php-fpm/etc/rc.d/init.d/php-fpm
[[email protected]]chmod+x/etc/rc.d/init.d/php-fpm
[[email protected]]chkconfigphp-fpmon
為了保障網站的安全性,禁用掉不安全的功能:
[[email protected]]vim/usr/local/php/etc/php.ini
//修改第305行的disable_functions參數,追加參數為:
disable_functions=passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space,posix_ctermid,posix_get_last_error,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname
配置nginx服務程序支持php:
[[email protected]]vim/usr/local/nginx/conf/nginx.conf
//將第2行前面的號去掉並修改為userwwwwww;
//將第45行參數修改為indexindex.htmlindex.htmindex.php;
//將第65-71行前面的號去掉,修改為:
location~.php${
roothtml;
fastcgi_pass127.0.0.1:9000;
fastcgi_indexindex.php;
fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name;
includefastcgi_params;
}
重啟nginx與php-fpm服務程序:
[[email protected]]systemctlrestartnginx
[[email protected]]systemctlrestartphp-fpm