linux教程之centos情况下lnmp安拆卸置
在学习初期,你一定会遇到很多困难,或者说各种困难,所以你最好先将你linux中的重要内容备份,因为,在你学习的过程中,很可能将系统搞废(eg:源混乱等);安装依附库和开辟情况
。代码以下:
#依附库和开辟工具
yum-yinstallgccgcc-c++autoconflibjpeglibjpeg-devellibpnglibpng-develfreetypefreetype-devellibxml2libxml2-develzlibzlib-develglibcglibc-develglib2glib2-develbzip2bzip2-develncursesncurses-develcurlcurl-devele2fsprogse2fsprogs-develkrb5krb5-devellibidnlibidn-developensslopenssl-developenldapopenldap-develnss_ldapopenldap-clientsopenldap-servers
#Nginx
yum-yinstallpcre-develzlib-devel
#Php
yum-yinstallgd-devellibjpeg-devellibpng-develfreetype-devellibxml2-develcurl-develfreetype-devel
#Mysql
yum-yinstallbisongccgcc-c++autoconfautomakezlib*libxml*ncurses-devellibtool-ltdl-devel*mysql-devel
下载软件包
#创立目次
mkdir/web
cd/web
#PHP5.3.8
wgethttp://php.net/distributions/php-5.3.8.tar.bz2
#PHP库文件
wgethttp://ncu.dl.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz
wgethttp://ncu.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz
wgethttp://ncu.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
wgethttp://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
#Nginx1.5.3
wgethttp://www.nginx.org/download/nginx-1.5.3.tar.gz
#Nginx(pcre)
wgetftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.13.tar.gz
假如没有8.13能够这里ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/下载最新
#Mysql5.5.17
wgethttp://mysql.mirrors.pair.com/Downloads/MySQL-5.5/mysql-5.5.32.tar.gz
下载最新的:http://mysql.mirrors.pair.com/Downloads/MySQL-5.5/
#Mysql(cmake)
wgethttp://www.ckuyun.com/files/v2.8/cmake-2.8.6.tar.gz
安装mysql
。代码以下:
#安装cmake
tar-zxvfcmake-2.8.6.tar.gz
cdcmake-2.8.6/
./configure
gmake&&gmakeinstall&&cd../
#增加mysql用户
/usr/sbin/groupaddmysql
/usr/sbin/useradd-gmysqlmysql
mkdir-p/data/mysql
chown-Rmysql:mysql/data/mysql
#安装Mysql
tar-zxvfmysql-5.5.17.tar.gz
cdmysql-5.5.17
cmake.-DCMAKE_INSTALL_PREFIX=/usr/local/mysql-DMYSQL_DATADIR=/data/mysql-DSYSCONFDIR=/etc/
make&&makeinstall
#设置Mysql
#在support-files目次中有五个设置信息文件:
#my-small.cnf(内存<=64M)
#my-medium.cnf(内存128M)
#my-large.cnf(内存512M)
#my-huge.cnf(内存1G-2G)
#my-innodb-heavy-4G.cnf(内存4GB)
cd/usr/local/mysql
cp./support-files/my-medium.cnf/etc/my.cnf
vi/etc/my.cnf
#在段增添
datadir=/data/mysql
wait-timeout=30
max_connections=512
default-storage-engine=MyISAM
#在段修正
max_allowed_packet=16M
#天生受权表
cd/usr/local/mysql
./scripts/mysql_install_db--user=mysql
#变动暗码
/usr/local/mysql/bin/mysqladmin-urootpassword123456
#开启mysql
/usr/local/mysql/bin/mysqld_safe&
#测试毗连mysql
/usr/local/mysql/bin/mysql-uroot-p123456
showdatabases;
exit;
#设置开机启动
vi/etc/rc.d/rc.local
#到场
/usr/local/mysql/bin/mysqld_safe&
大概呈现ERROR2002(HY000):CantconnecttolocalMySQLserverthroughsocket/tmp/mysql.sock(2)
cd/tmp//发明没有
ln-s/var/lib/mysql/mysql.sock/tmp/mysql.sock
cd/var/run/
chown-Rmysqlmysqld
安装php
。代码以下:
#1
tar-zxvflibiconv-1.14.tar.gz&&cdlibiconv-1.14/
./configure--prefix=/usr/local
make&&makeinstall&&cd../
#2
tar-zxvflibmcrypt-2.5.8.tar.gz&&cdlibmcrypt-2.5.8/
./configure&&make&&makeinstall
/sbin/ldconfig&&cdlibltdl/&&./configure--enable-ltdl-install
make&&makeinstall&&cd../
#3
tar-zxvfmhash-0.9.9.9.tar.gz&&cdmhash-0.9.9.9/&&./configure
make&&makeinstall&&cd../
#4
ln-s/usr/local/lib/libmcrypt.la/usr/lib/libmcrypt.la
ln-s/usr/local/lib/libmcrypt.so/usr/lib/libmcrypt.so
ln-s/usr/local/lib/libmcrypt.so.4/usr/lib/libmcrypt.so.4
ln-s/usr/local/lib/libmcrypt.so.4.4.8/usr/lib/libmcrypt.so.4.4.8
ln-s/usr/local/lib/libmhash.a/usr/lib/libmhash.a
ln-s/usr/local/lib/libmhash.la/usr/lib/libmhash.la
ln-s/usr/local/lib/libmhash.so/usr/lib/libmhash.so
ln-s/usr/local/lib/libmhash.so.2/usr/lib/libmhash.so.2
ln-s/usr/local/lib/libmhash.so.2.0.1/usr/lib/libmhash.so.2.0.1
ln-s/usr/local/bin/libmcrypt-config/usr/bin/libmcrypt-config
#5
tar-zxvfmcrypt-2.6.8.tar.gz&&cdmcrypt-2.6.8/
/sbin/ldconfig
./configure
make&&makeinstall&&cd../
#6
tar-xjvfphp-5.3.8.tar.bz2
cdphp-5.3.8
./configure--prefix=/usr/local/php
--with-config-file-path=/usr/local/php/etc
--with-iconv-dir=/usr/local/--with-freetype-dir
--with-mysql=/usr/local/mysql
--with-mysqli=/usr/local/mysql/bin/mysql_config
--with-jpeg-dir--with-png-dir--with-zlib
--with-mhash--enable-sockets--enable-ftp
--with-libxml-dir--enable-xml--disable-rpath
--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-ldap--with-ldap-sasl
--enable-fpm
--with-xmlrpc--enable-zip--enable-soap
--without-pear
makeZEND_EXTRA_LIBS=-liconv
#注重这里简单呈现make:***毛病127
#呈现mysqlclient办理办法
#ln-s/usr/local/mysql/lib/libmysqlclient.so/usr/lib/
#ln-s/usr/local/mysql/lib/libmysqlclient.so.18/usr/lib/libmysqlclient.so.18
#大概chmod:没法会见“ext/phar/phar.phar”:没有谁人文件或目次
#make:毛病1(疏忽)
#办理办法在编译的时分加--without-pear参数
#假如还不可,make的时分不增加ZEND_EXTRA_LIBS=-liconv参数
makeinstall
#选择PHP.ini设置文件
cpphp.ini-production/usr/local/php/etc/php.ini
变动PHP-FPM
#增加WWW用户
/usr/sbin/groupaddwww&&/usr/sbin/useradd-gwwwwww
mkdir-p/var/log/nginx&&chmod+w/var/log/nginx&&chown-Rwww:www/var/log/nginx
mkdir-p/data/www&&chmod+w/data/www&&chown-Rwww:www/data/www
cp/usr/local/php/etc/php-fpm.conf.default/usr/local/php/etc/php-fpm.conf
vi/usr/local/php/etc/php-fpm.conf
#往失落/变动设置文件中的;
pm.max_children=64
pm.start_servers=20
pm.min_spare_servers=5
pm.max_spare_servers=35
pm.max_requests=1024
user=www
group=www
#反省语法是不是准确
/usr/local/php/sbin/php-fpm-t
#呈现NOTICE:configurationfile/usr/local/php/etc/php-fpm.conftestissuccessful测试乐成
/usr/local/php/sbin/php-fpm&
#设置开机启动
vi/etc/rc.d/rc.local
#外行末到场
/usr/local/php/sbin/php-fpm&
#前往安装包目次
cd/web
安装Nginx
#安装pcre库
tar-zxvfpcre-8.13.tar.gz&&cdpcre-8.13/&&./configure
make&&makeinstall&&cd../
#安装Nginx
tar-zxvfnginx-1.0.9.tar.gz&&cdnginx-1.0.9&&
./configure--user=www--group=www
--prefix=/usr/local/nginx
--sbin-path=/usr/local/nginx/sbin/nginx
--conf-path=/usr/local/nginx/conf/nginx.conf
--with-http_stub_status_module
--with-http_ssl_module
--with-pcre
--lock-path=/var/run/nginx.lock
--pid-path=/var/run/nginx.pid
make&&makeinstall&&cd../
#变动设置
vi/usr/local/nginx/conf/nginx.conf
#修正一些参数,别间接交换文件,这只是一部分
。代码以下:
userwww
events{
useepoll;
worker_connections1024;
}
location~.php${
roothtml;
fastcgi_pass127.0.0.1:9000;
fastcgi_indexindex.php;
fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name;
includefastcgi_params;
}
。代码以下:
#注重这里
#$document_root$fastcgi_script_name;
#检测设置文件
/usr/local/nginx/sbin/nginx-t
#提醒暗示乐成
#nginx:theconfigurationfile/usr/local/nginx/conf/nginx.confsyntaxisok
#nginx:configurationfile/usr/local/nginx/conf/nginx.conftestissuccessful
#开启Nginx
/usr/local/nginx/sbin/nginx&
#光滑重启Nginx
/usr/local/nginx/sbin/nginx-sreload
#增加开机启动
vi/etc/rc.d/rc.local
#最初移行到场
/usr/local/nginx/sbin/nginx
#测试
cd/usr/local/nginx/html/
touchindex.php
vi/usr/local/nginx/html/index.php
。代码以下:
<?php
phpinfo();
?>
phpmyadmin下载地点
http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/4.0.4.2/phpMyAdmin-4.0.4.2-all-languages.tar.gz/download
#discuz伪静态
。代码以下:
rewrite^([^.]*)/topic-(.+).html$$1/portal.php?mod=topic&topic=$2last;
rewrite^([^.]*)/article-(+)-(+).html$$1/portal.php?mod=view&aid=$2&page=$3last;
rewrite^([^.]*)/forum-(w+)-(+).html$$1/forum.php?mod=forumdisplay&fid=$2&page=$3last;
rewrite^([^.]*)/thread-(+)-(+)-(+).html$$1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3last;
rewrite^([^.]*)/group-(+)-(+).html$$1/forum.php?mod=group&fid=$2&page=$3last;
rewrite^([^.]*)/space-(username|uid)-(.+).html$$1/home.php?mod=space&$2=$3last;
rewrite^([^.]*)/blog-(+)-(+).html$$1/home.php?mod=space&uid=$2&do=blog&id=$3last;
rewrite^([^.]*)/(fid|tid)-(+).html$$1/index.php?action=$2&value=$3last;
if(!-e$request_filename){
return404;
}
无论图形界面发展到什么水平这个原理是不会变的,Linux命令有许多强大的功能:从简单的磁盘操作、文件存取、到进行复杂的多媒体图象和流媒体文件的制作。 目前全球有超过一百多个Linux发行版本,在国内也能找到十几个常见版本。如何选择请根据你的需求和能力,RedhatLinux和DebianLinux是网络管理员的理想选择。 最好先搜寻一下论坛是否有您需要的文章。这样可以获得事半功倍的效果。 Windows?是图形界面的,Linux类似以前的?DOS,是文本界面的,如果你运行了图形界面程序X-WINDOWS后,Linux?也能显示图形界面,也有开始菜单、桌面、图标等。 在学习linux的工程中,linux学习方法有很多种,这里是小编的学习心得,给大家拿出来分享一下。 感谢老师和同学们在学习上对我的帮助。 为了更好的学习这门课程,我不仅课上认真听讲,课下也努力学习,为此还在自己的电脑上安装了Ubuntu系统。 其次,Linux简单易学,因为我们初学者只是学的基础部分,Linux的结构体系非常清晰,再加上老师循序渐进的教学以及耐心的讲解,使我们理解起来很快,短期内就基本掌握了操作和运行模式。
页:
[1]