LAMP观景搭建
LINUX:
Ubuntu系统
更改root密码,用root登录安装软件很方便
sudo passwd root
更新软件下载列表
apt-get update
安装常用编译工具
apt-get install build-essential
升级系统
apt-get dist-upgrade
安装常用库:
apt-get install
cmake flex openssl zlib pcre automake libtool bisonlibncurses subversion gnu-standards libxml2 libssl-dev libcurl4-openssl libcurl4 openssl-dev libjpeg62 libjpeg62-dev libpng12-0 libpng12-dev libfreetype6 libfreetype6-dev libmcrypt4 libmcrypt-dev libmhash2 libmhash-dev libsasl2-dev libpcre3 libpcre3-dev libbz2 libbz2-dev libmemcached5 libmemcache-dev libevent-1.4-2 libevent-dev libzip1 libzip-dev libglib2.0 libiconv
安装过程中缺的库可以通过apt-cache search libname查找,用apt-get install libname安装
MySQL安装:
groupadd mysql
useradd -r -g mysql mysql -d /dev/null -s /sbin/nologin
mkdir -r /data/mysqldata /data/httpd /data/etc
cmake . /
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql /
-DMYSQL_DATADIR=/data /
-DDEFAULT_CHARSET=utf8 /
-DDEFAULT_COLLATION=utf8_general_ci /
-DEXTRA_CHARSETS=all /
-DWITH_INNOBASE_STORAGE_ENGINE=ON /
-DWITH_EMBEDDED_SERVER=ON /
-DENABLED_LOCAL_INFILE=ON /
-DWITH_READLINE=ON/
-DWITH_LIBWRAP=ON/
-DWITH_ZLIB=bundled /
-DWITH_SSL=bundled /
-DWITH_DEBUG=OFF
make -j4
make install
cd /usr/local/
chown -R mysql.mysql mysql
chmod -R 755 mysql
chown -R mysql.mysql /data/mysqldata && chmod -R 755 /data/mysqldata
拷贝配置文件
cp SRC/support-files/my-medium.cnf /etc/my.cnf
添加启动脚本
cp SRC/support-files/mysql.server /etc/init.d/mysql.server
chmod 755 /etc/init.d/mysql.server
加载权限表
./mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysqldata
启动MySQL
./bin/mysqld_safe --user=mysql& or /etc/init.d/mysql.server start
/usr/local/mysql/bin/mysql_secure_installation
/usr/local/mysql/bin/mysqladmin -u root [-h localhostname] password 'new-password'
perl ./mysql/mysql-tes/mysql-test-run.pl
设置自启动
#echo /usr/local/mysql/bin/mysqld_safe --user=mysql & > /etc/rc.d/rc.local
PHP (5.3以上)安装:
./configure --prefix=/usr/local/php --with-config-file-path=/etc --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-bz2 --with-libxml-dir --with-curl --with-curlwrappers --with-mcrypt --with-gd --with-openssl --with-mhash --with-ldap --with-ldap-sasl --with-xmlrpc --enable-xml --with-xsl --enable-bcmath --enable-calendar --enable-shmop --enable-inline-optimization --enable-mbregex --enable-fpm --enable-mbstring --enable-gd-native-ttf --enable-pcntl --enable-sockets --enable-zip --enable-soap --enable-dba --enable-sysvsem --enable-sysvshm --enable-sysvmsg --disable-rpath --disable-debug
如果configure失败,执行rm config.cache
make ZEND_EXTRA_LIBS='-liconv'
如果一些*.so找不到的错误:
vim /etc/ld.so.conf
add /usr/local/lib
ldconfig
安装
make test
make install
cp SRC/php.ini-production /etc/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp SRC/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
Nginx安装:
groupadd www
useradd -r -g www www -d /dev/null -s /sbin/nologin
#with-http_stub_status_module
#monitor status , so not install in product line env
./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module
make
make install
设置自启动
#echo /usr/local/webserver/nginx/sbin/nginx [--user=www?]& > /etc/rc.d/rc.local
Nginx -s stop 快速关闭Nginx,可能不保存相关信息,并迅速终止web服务。(quick exit)
Nginx -s quit 平稳关闭Nginx,保存相关信息,有安排的结束web服务。 (graceful exit)
Nginx -s reload 因改变了Nginx相关配置,需要重新加载配置而重载。 (changing configuration)
Nginx -s reopen 重新打开日志文件。 (reopenging log files)
设置nginx支持PATHINFO:
vim fastcgi_param.conf
fastcgi_param PATH_INFO $path_info;
vim nginx.conf
set $path_info "";
if ($fastcgi_script_name ~ "^(.+?/.php)(/.+)
set $path_info $2;
fastcgi_param PATH_INFO $path_info;
安装完毕后可通过安装PHPMYADMIN测试上面的安装是否正确