资源描述
蓝色表达目录;
绿色表达可执行文献;
红色表达压缩文献;
浅蓝色表达链接文献;
灰色表达其他文献;
红色闪烁表达链接文献有问题了;
黄色是设备文献,涉及block,char,fifo。
用dircolors -p看到缺省颜色设立,涉及各种颜色和“粗体”,下划线,闪烁等定义。
系统:Liunx As4 Updata4
所用软件:
1.mysql-5.0.20a.tar.gz
2.httpd-2.2.4.tar.gz
3.Zlib-1.2.2
4.Freetype-2.1.5
5.Libpng-1.2.5
6.Jpegsrc.v6b
7.GD-2.0.33
8.GetText-0.12.1
9.ImageMagick-6.2.5-5
10.Imagick-0.9.8.tgz
11.PHP-4.3.10
12.ZendOptimizer-2.6.0
13.phpMyAdmin-2.8.0.2.zip
14.vsftpd-2.0.3.tar.gz
一,Mysql
解压
[root@localhost root]tar -zxvf mysql-5.0.20a.tar.gz
解压后会在当前目录下产生一种mysql-5.0.2-a目录。
进入mysql-5.0.2-a目录
[root@localhost root]l# cd mysql-5.0.20a
[]#./configure --prefix=/usr/local/mysql --with-extra-charsets=all
选项阐明:
--prefix=/usr/local/mysql是指安装mysql途径
这里我安装途径是/usr/local/mysql,你可以指定不同途径
--with-extra-charsets=all 让mysql支持多语言
编译及安装 (此过程会占用一段时间)
[root@localhost mysql-5.0.20a]# make
[root@localhost mysql-5.0.20a]# make install
建立MySQL初始化Table
[root@localhost mysql-5.0.20a]# scripts/mysql_install_db
阐明∶建立MySQL Grant Table,第一次安装MySQL都必要执行这个指令
[root@localhost mysql-5.0.20a]# cp support-files/my-f /etc/f
咱们得把文献f文献放到/etc/目录下。让mysql服务器启动时能找到它。
安装好mysql后,配制文献应当在/usr/local/mysql/share/mysql目录中,配制文献有几种,有my-f my-f my-f my-f
,不同流量网站和不同配制服务器环境,固然需要有不同配制文献了。普通状况下,my-f这个配制文献就能满足咱们大多需要;
[root@localhost mysql-5.0.20a]#cd /usr/local/mysql
[root@localhost mysql]#bin/mysql_install_db –user=mysql
[root@localhost mysql]#chown –R root .
[root@localhost mysql]#chown –R mysql var
建立mysql群组以及使用者,并以mysql身份起动server
[root@localhost mysql-5.0.20a]# groupadd mysql
[root@localhost mysql-5.0.20a]# useradd mysql -g mysql
[root@localhost mysql-5.0.20a]# chown -R root /usr/local/mysql
[root@localhost mysql-5.0.20a]# chown -R mysql /usr/local/mysql/var
[root@localhost mysql-5.0.20a]# chgrp -R mysql /usr/local/mysql
[root@localhost mysql-5.0.20a]# /usr/local/mysql/bin/mysqld_safe --user=mysql &
Ps axu | grep mysql
测试MySQL Server是不是有正常运作
Shell# /usr/local/mysql/bin/mysqladmin version
Shell# /usr/local/mysql/bin/mysqladmin variables
MySQL 两种自启动方式:
第一种方式:将 MySQL 作为服务,当系统启动时自动加载此服务并自动运营,在开机时候就可以看到 MySQL 与否正常启动。实现办法:
Cp /usr/local/mysql/share/mysql/mysql.server /etc/rc.d/init.d/mysqld
cd /etc/rc.d/init.d chkconfig --add mysqld ntsysv
第二种方式:将 MySQL 作为批解决方式自动运营。实现方式:
vi /etc/rc.d/rc.local
/usr/local/mysql/share/mysql/mysqld start
测试
root@localhost mysql]# bin/mysql
Welcome to the MySQL monitor. Commands end with ;or \g.
Your MySQL connection id is 14 to server version:5.0.2-alpha
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
启动成功
看看是不是有数据库,应当和var目录下目录名字同样
mysql> show databases;
我这里已有4个数据库了。
”;”符号 是mysql结束符,你想让mysql执行你指令就必要输入 ;
mysql> exit
Bye
[root@localhost mysql]#
退出数据库。
在mysql/bin目录下有个mysqladmin工具是用来管理和操作mysql用,咱们用她来给 root 加上密码
[root@localhost mysql]#bin/mysqladmin –u root password 123456
这样咱们就给root设立了 123456 这个密码
再次登录
[root@localhost mysql]# bin/mysql
上次咱们使用这个命令连接mysql,看看密码与否生效。
[root@localhost mysql]# bin/mysql
ERROR 1045 (28000):Access denied for user 'root'@'localhost' (using password:NO)
[root@localhost mysql]#
进不去了,阐明密码设立成功。
咱们在用密码试试,这时应当阐明是什么顾客登录,这里咱们用是 root 这个顾客。
[root@localhost mysql]# bin/mysql -uroot -p
Enter password: 这里密码是不显示,不要按错键盘就行
Welcome to the MySQL monitor. Commands end with ;or \g.
Your MySQL connection id is 18 to server version:5.0.2-alpha
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
简介几种管理数据库惯用命令,
查看数据库:
mysql> show databases
新建数据库:
mysql> create database [新数据库名]
删除数据库:
mysql> drop database [要删除数据库名]
指定一种数据库为当前数据库
mysql>use [数据库名]
备份数据库:
[root@localhost mysql]# /usr/local/mysql/bin/mysqldump -uroot -p 123456 > /root/shuifu.sql
Enter password:这里输入数据库密码
二.Apache
1.安装
解压
[root@localhost root]# tar zxvf httpd-2.2.4.tar.gz
进入刚解压文献夹,仔细查看INSTALL文献,按照阐明配备安装apache,
[root@localhost root]# cd httpd-2.2.4
[root@localhosthttpd-2.2.4]#./configure --prefix=/usr/local/apache2 --enable-so-mods-shared=all
# apache2是你想要安装目录,可以自行更改。
进入apache2文献夹,安装apache
[root@localhosthttpd-2.2.4]# cd /usr/local/apache2
[root@localhost httpd-2.2.4]# make
[root@localhost httpd-2.2.4]# make install
# 启动apache,看见成功欢迎页面
[root@localhost apache2]# ./bin/apachectl start
可以测试下apache,在htdocs下新建test文献夹,在里面建立一种html文献。这样就可以通过浏览器来访问了。在htdocs中有一种index.html文献,咱们可以用IE浏览器打开。
如果有遇到apache回绝页面访问祈求,普通需要授权就可以解决了。
# chmod 777 /usr/local/apache2/*
第一种方式:将 Apache 作为服务,当系统启动时自动加载此服务并自动运营,在开机时候就可以看到 Apache 与否正常启动。实现办法:
cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd
vi /etc/rc.d/init.d/httpd,在httpd文献第三行下面,插入如下两句话:
# chkconfig:345 85 15
# description:Starts and stops the Apache HTTP Server.
chmod +x /etc/rc.d/init.d/httpd
chkconfig --add httpd
chkconfig –list
成功后,就可以用 service httpd start,service httpd restart,service httpd stop来启动、重启、和终结 httpd service。
第二种方式:以批解决自动运营,实现办法:
vi /etc/rc.d/rc.local
/usr/local/apache/bin/apachectl start
#DocumentRoot "/var/www/html"
DocumentRoot "/backup"
Alias /html/ "/var/www/html" #定义html虚拟目录
Alias /opt "/opt" #定义opt虚拟目录
<Directory "/opt"> #定义相应虚拟目录配备
Options Indexes FollowSymLinks
# Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
添加密码htpasswd目录在./root/httpd-2.2.4/support/htpasswd
三,GD 支持安装配备
GD 成功安装和使用还依赖其他几种组件模块,因此在 GD 安装之前需要先安装好其他组件模块。为此,先建立模块初始目录:
mkdir /usr/local/modules
mkdir /usr/local/modules/jpeg6
mkdir /usr/local/modules/jpeg6/bin
mkdir /usr/local/modules/jpeg6/lib
mkdir /usr/local/modules/jpeg6/include
mkdir /usr/local/modules/jpeg6/man
mkdir /usr/local/modules/jpeg6/man/man1
依照顺序安装 GD 其他组件:
A.安装 Zlib
tar xzvf zlib-1.2.2.tar.gz
cd zlib-1.2.2
./configure
make
make install
B.安装 Freetype
tar xzvf freetype-2.1.5.tar.gz
cd freetype-2.1.5
./configure --prefix=/usr/local/modules/freetype
make
make install
C.安装 Libpn
tar xzvf libpng-1.2.5.tar.gz
cd libpng-1.2.5
cp scripts/makefile.std makefile
make test
make install
D.安装 Jpeg6
tar xzvf jpegsrc.v6b.tar.gz
./configure --prefix=/usr/local/modules/jpeg6 --enable-shared --enable-static
make
make install
开始安装 GD 支持
tar xzvf gd-2.0.33.tar.gz
cd gd-2.0.33
./configure --prefix=/usr/local/modules/gd --with-jpeg=/usr/local/modules/jpeg6 --with-png --with-zlib --with-freetype=/usr/local/modules/freetype
make
make install
至此,GD 库支持就算是完毕了!
四、php安装
版本php-4.3.11
解压php
[root@localhost server]# tar zxvf php-4.3.11.tar.gz
[root@localhost server]#cd php ---->
[root@localhost server]# ./configure --prefix=/usr/local/php --with-gd=/usr/local/modules/gd --with-jpeg-dir=/usr/local/modules/jpeg6 --with-zlib --with-png --with-freetype-dir=/usr/local/modules/freetype --with-mysql=/usr/local/mysql --with-iconv --enable-mbstring --with-apxs2=/usr/local/apache/bin/apxs --with-gettext=/usr/local/gettext --enable-track-vars --enable-ftp --enable-safe-mode --enable-xml --enable-magic-quotes --disable-debug --with-config-file-path=/usr/local/php/etc
参数阐明:
指定安装途径
> --prefix=/usr/local/php \
指定mysql安装途径,一定要绝对途径,否则编译会失败,
> --with-mysql=/usr/local/mysql \
这个参数是加入apache中为DSO模块位置,apache2如下版本参数是apxs而不是apxs2,如果用apache版本不是2.0以上就去掉2,
就像这样--with-apxs=PATH
> --with-apxs2=/usr/local/httpd/bin/apxs \
指定php配制文献存储目录是/usr/local/httpd/conf目录,咱们安装完毕后,也要把php.ini复制到这个目录中来
> --with-config-file-path=/usr/local/httpd/conf
让apache支持zlib(当时并未注意,直到安装MAMBO时候,才给出红色警告)
> --with-zlib
> --with-gd 支持GD模块,大某些php程序都会有这个规定,没有也无所谓,有些不一定
接下来环节和安装mysql时候同样:
# make
# make install
这里我要指出是在编译时候遇到某些问题
错误:
configure: error: mysql configure failed. Please check config.log for more information.
也许你用是icc编译版本并不适合你系统,换一种mysql版本就可以了。
mysql-***-***-icc.tar.gz
error: Cannot find MySQL header files under /usr/bin/
浮现这种错误,普通是configure时候给出参数时 所指定途径格式错误,导致找不到mysql头文献,
默认库文献是在/usr/lib, 头文献是在:/usr/include里,程序会自己寻找,只要对的指定你mysql安装目录就可以了。
checking lex output file root... ./configure: line 2356: lex: command not found
configure: error: cannot find output from lex; giving up
If configure fails try --with-jpeg-dir=<DIR>
configure: error: libpng.(a|so) not found.
这个错误应当是flex包没有安装或则安装有错误,只要重新安装一下这个包就可以了。
If configure fails try --with-jpeg-dir=<DIR>
configure: error: libpng.(a|so) not found.
你也许想让php支持jpeg格式,但是你没有安装libjpeg包
因此编译时候没有找到jpeg包安装目录。
在我映像中这个包要在安装GD包之前安装,否则编译也会出错,不懂得是不是这样?
以上几种是我在安装过程中遇到比较典型错误。
接下来是后期配备
复制php.ini-dist为php.ini,并存储到编译时咱们指定目录中/usr/local/httpd/conf/php.ini
编辑/usr/local/httpd/conf/php.ini文献,找到如下一行
;default_charset = "iso-8859-1"
在这行下面加一行
default_charset = "gb2312"
配备apache httpd.conf文献,在httpd.conf文献中查找:
# Dynamic Shared Object (DSO) Support
在这某些中加入需要调用PHP模块位置。
LoadModule php4_module modules/libphp4.so
查找:
DirectoryIndex index.html
在背面加入 index.php 让PAPCHE 也能打开默认首页为php文献。
查找:
#AddType application/x-tar .tgz
在下面加入
#AddType application/x-httpd-php .php
重启一下apache。
测试一下PHP环境是不是可以运营。把下面这一句另存为PHP网页(如:test.php),
<? phpinfo(); ?>
五,ZendOptimizer安装
之因此要安装ZendOptimizer是由于某些商业PHP程序对代码进行了加密,因此必要安装此组件才干对的地运营这些商业程序,例如:Discuz等等。ZendOptimizer安装非常简朴:
tar zxvf ZendOptimizer-2.6.0-linux-glibc21-i386.tar.gz
cd ZendOptimizer-2.6.0-linux-glibc21-i386
./install.sh
接下来弹出简朴图形安装界面,一路下一步,注意是到Enter the location of your php.ini file这项配备时填入PHP配备文献php.ini文献位置,最后完毕安装。
/usr/local/lib
六,phpMyAdmin安装
命令如下:
#Cd /usr/local/apache2/htdocs //进入所在目录
#unzip phpMyAdmin-2.8.0.2.zip
#cd phpMyAdmin-2.8.0.2
解压后得到一种目录,与此前版本不同,2.8版phpMyAdmin 根目录中没有名为 config.inc.php 配备文献,当前配备文献是 libraries/config.default.php 进在该文献中。可把此文献拷贝到phpMyAdmin 目录进行修改!
或通过phpMyAdmin 根目录中scripts/setup.php文献自动生成。
如下为配备文献内容
<?php
/*
* Generated configuration file
* Generated by:phpMyAdmin 2.8.0.3 setup script by Michal ?iha?<>
* Version:$Id:setup.php,v 1.23.2.2.2.1 /03/08 19:06:48 nijel Exp $
* Date:Fri,27 Oct 06:02:51 GMT
*/
/* Servers configuration */
$i = 0;
/* Server localhost (cookie) [1] */
$i++;
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* End of servers configuration */
$cfg['blowfish_secret'] = '4541a103272f77.97202349';
?>
参照配备资料:
找到 $cfg['PmaAbsoluteUri']
修改你将上传到空间phpMyAdmin网址
如:$cfg['PmaAbsoluteUri'] = 'http://你站点/phpmyadmin/';
尚有下面
$cfg['Servers'][$i]['host'] = 'localhost';(通惯用默认,也有例外)
$cfg['Servers'][$i]['auth_type'] = 'cookie';// Authentication method (config,http or cookie based)?
config:按照 自身 libraries/config.default.php 文献中配备提供顾客名和密码
cookie:用于输入口令方式登陆,如果选取此项,需要设立$cfg['blowfish_secret'] = 'cookie';(见背面简介)
$cfg['Servers'][$i]['user'] = 'root';// MySQL user(顾客名,自己机里用root,在网上设你mysql顾客名)
$cfg['Servers'][$i]['password'] = '';// MySQL password (only needed
自己机里不用设
$cfg['Servers'][$i]['only_db'] = '';// If set to a db-name,only(你只有一种数据就设立一下)
注:$cfg['blowfish_secret'] = '';
本机话不需要设立,但是网络话需要设立成cookie:
$cfg['blowfish_secret'] = 'cookie';
设立完毕可以上传到网上了。
浏览http://你站点/phpmyadmin/ 固然你设立不同就用那个网址。
如果设立$cfg['Servers'][$i]['auth_type'] = 'cookie';
六,vsftpd-1.2.0.tar.gz安装
⑴准备条件
VSFTPD默认配备中需要“nobody”顾客。在系统中添加此顾客,如果顾客已经存在,useradd命令有相应提示。
[root@hpe45 root]# useradd nobody
useradd:user nobody exists
VSFTPD默认配备中需要“/usr/share/empty”目录。在系统中此目录,如果目录已经存在,mkdir命令有相应提示。
[root@hpe45 root]# mkdir /usr/share/empty/
mkdir:cannot create directory '/usr/share/empty':File exists
VSFTPD提供匿名FTP服务时,需要“ftp”顾客和一种有效匿名录录。
[root@hpe45 root]#
接下来操作对于ftp顾客与否已经存在都是有用。
[root@hpe45 root]# chown root.root /var/ftp
[root@hpe45 root]# chmod og-w /var/ftp
⑵编译VSFTPD
从官方站点下载到/root目录,执行如下命令:
[root@hpe45 root]# tar zxvf vsftpd-1.2.0.tar.gz
[root@hpe45 root]# cd vsftpd-1.2.0
[root@hpe45 vsftpd-1.2.0]# make
⑶安装编译好VSFTPD
执行“make install”将编译好二进制文献、手册等复制到相应目录。在RHL9上,也许需要手动执行如下复制:
[root@hpe45 vsftpd-1.2.0]# cp vsftpd /usr/local/sbin/vsftpd
[root@hpe45 vsftpd-1.2.0]# cp vsftpd.conf.5 /usr/local/share/man/man5
[root@hpe45 vsftpd-1.2.0]# cp vsftpd.8 /usr/local/share/man/man8
此外,“make install”没有复制简朴配备文献,建议执行如下命令:
[root@hpe45 vsftpd-1.2.0]# cp vsftpd.conf /etc
⑷为本地顾客设立PAM
如果容许本地顾客登录VSFTPD,执行如下操作:
[root@hpe45 vsftpd-1.2.0]# cp RedHat/vsftpd.pam /etc/pam.d/ftp
3、VSFTPD文献构造
VSFTPD文献构造是很简洁,重要涉及:
/usr/sbin/vsftpd ---- VSFTPD主程序
/etc/rc.d/init.d/vsftpd ---- 启动脚本
/etc/vsftpd/vsftpd.conf ---- 主配备文献
/etc/pam.d/vsftpd ---- PAM认证文献
/etc/vsftpd.ftpusers ---- 禁止使用VSFTPD顾客列表文献
/etc/vsftpd.user_list ---- 禁止或容许使用VSFTPD顾客列表文献
/var/ftp ---- 匿名顾客主目录
/var/ftp/pub ---- 匿名顾客下载目录
此外,尚有某些阐明文档和手册文献。
此外VSFTPD日记文献位于/etc/logrotate.d/vsftpd.log。
三、三种方式实现
1、匿名顾客形式实现
# vi builddefs.h \\\\编辑builddefs.h 文献,文献内容如下:
#ifndef VSF_BUILDDEFS_H
#define VSF_BUILDDEFS_H
#undef VSF_BUILD_TCPWRAPPERS
#define VSF_BUILD_PAM
#undef VSF_BUILD_SSL
#endif /* VSF_BUILDDEFS_H */
将以上undef都改为define,支持tcp_wrappers,支持PAM认证方式,支持SSL
创立必要帐号,目录:
# useradd nobody //也许你系统已经存在此帐号,那就不用建立
# mkdir /usr/share/empty //也许你系统已经存在此目录,那就不用建立
# mkdir /var/ftp //也许你系统已经存在此目录,那就不用建立
# useradd -d /var/ftp ftp //也许你系统已经存在此帐号,那就不用建立
# chown root:root /var/ftp
# chmod og-w /var/ftp
请记住,如果你不想让顾客在本地登陆,那么你需要把她登陆SHELL设立成/sbin/nologin,例如以上nobody和ftp我就设立成/sbin/nologin
安装vsftp配备文献,可执行程序,man等:
# install -m 755 vsftpd /usr/local/sbin/vsftpd-ano
# install -m 644 vsftpd.8 /usr/share/man/man8
# install -m 644 vsftpd.conf.5 /usr/share/man/man5
# install -m 644 vsftpd.conf /etc/vsftpd-ano.conf
这样就安装完毕了,那么咱们开始进行简朴配备
# vi /etc/vsftpd-ano.conf ,将如下三行加入文献
listen=YES
listen_port=21
tcp_wrappers=YES
anon_root=/var/ftp //设立匿名顾客本地目录,和ftp顾客目录必要相似
listen=YES意思是使用standalone启动vsftpd,而不是super daemon(xinetd)控制它 (vsftpd推荐使用standalone方式)
# mkdir /var/ftp/pub
# chmod -R 777 /var/ftp/pub
anonymous_enable=YES //容许匿名访问,这是匿名服务器必要
write_enable=YES //全局配备可写
no_anon_password=YES //匿名顾客login时不询问口令
anon_umask=077 //匿名顾客上传文献权限是-rw----
anon_upload_enable=YES //容许匿名顾客上传文献
anon_mkdir_write_enable=YES //容许匿名顾客建立目录
anon_other_write_enable=YES //容许匿名顾客具备建立目录,上传之外权限,如重命名,删除
dirmessage_enable=YES //当使用者转换目录,则会显示该目录下.message信息
xferlog_enable=YES //记录使用者所有上传下载信息
xferlog_file=/var/log/vsftpd.log //将上传下载信息记录到/var/log/vsftpd.log中
xferlog_std_format=YES //日记使用原则xferlog格式
idle_session_timeout=600 //客户端超过600S没有动作就自动被服务器踢出
data_connection_timeout=120 //数据传播时超过120S没有动作被服务器踢出
chown_uploads=YES
chown_username=daemon //上传文献属主
ftpd_banner=Welcome to d- FTP service. //FTP欢迎信息
anon_max_rate=80000 //这是匿名顾客下载速度为80KBytes/s
check_shell=NO //不检测SHELL
启动FTP服务进行测试:
\
2、本地顾客形式实现
# cd /home/xuchen/vsftpd-2.0.3 //进入vsftpd-2.0.3源代码目录
#
展开阅读全文