LAMP平台配置编译安装.docx
- 文档编号:25986116
- 上传时间:2023-06-17
- 格式:DOCX
- 页数:18
- 大小:345.11KB
LAMP平台配置编译安装.docx
《LAMP平台配置编译安装.docx》由会员分享,可在线阅读,更多相关《LAMP平台配置编译安装.docx(18页珍藏版)》请在冰豆网上搜索。
LAMP平台配置编译安装
Apache编译安装
解压配置
编译并安装即可
或者直接配置编译安装
安装mysql
创建运行mysql的帐号
解压配置编译安装
-------------------------------------------------------------------------
Error:
Nocurses/termcaplibraryfound
问题原因没有curses/termcap支持的软件包
解决方法:
yum-yinstalllibtermcap-devel
ncurses-5.2.tar.gz
--------------------------------------------------------------------------
建立配置文件
初始化数据库/var
[root@localhostmysql-5.0.56]#/usr/local/mysql/bin/mysql_install_db--user=mysql
修改主目录/usr/local/mysql权限,和数据库目录/var权限
[root@localhostmysql]#chown-Rroot:
mysql/usr/local/mysql/
[root@localhostmysql]#chown-Rmysql/usr/local/mysql/var/
调整lib库路径
Mysql安装到非标准路径中,所以还需要将mysql的库文件路径/usr/local/mysql/lib/mysql加入到系统库文件搜索路径中以便在需要的时候能够自动搜索到。
[root@localhostmysql]#echo"/usr/local/mysql/lib/mysql/">>/etc/ld.so.conf
[root@localhostmysql]#ldconfig
[root@localhostmysql]#cat/etc/ld.so.conf
includeld.so.conf.d/*.conf
/usr/local/mysql/lib/mysql/
[root@localhostmysql]#
启动mysql服务
使用mysqld_safa脚本启动服务
[root@localhostmysql]#/usr/local/mysql/bin/mysqld_safe--user=mysql&
[1]2419
[root@localhostmysql]#Startingmysqlddaemonwithdatabasesfrom/usr/local/mysql/var
[root@localhostmysql]#netstat-anpt|grep:
3306
tcp000.0.0.0:
33060.0.0.0:
*LISTEN2445/mysqld
[root@localhostmysql]#
2.将mysqld添加为系统服务
把解压目录下的support-files中的mysql.servercp到/etc/init..d中改名为mysqld
[root@localhostmysql]#cp/root/mysql-5.0.56/support-files/mysql.server/etc/init.d/mysqld
[root@localhostmysql]#chmod+x/etc/init.d/mysqld
[root@localhostmysql]#chkconfig--addmysqld
[root@localhostmysql]#chkconfigmysqldon
[root@localhostmysql]#chkconfig--level35mysqldon
[root@localhostmysql]#servicemysqldrestart
ShuttingdownMySQLSTOPPINGserverfrompidfile/usr/local/mysql/var/localhost.localdomain.pid
12030422:
49:
27mysqldended
[OK]
StartingMySQL[OK]
[1]+Done/usr/local/mysql/bin/mysqld_safe--user=mysql
[root@localhostmysql]#
为了方便使用mysql命令可以修改环境变量PATH把mysql命令存放路径添加进去
[root@localhostmysql]#exportPATH=$PATH:
/usr/local/mysql/bin/
[root@localhostmysql]#echo$PATH
/usr/kerberos/sbin:
/usr/kerberos/bin:
/usr/local/sbin:
/usr/local/bin:
/sbin:
/bin:
/usr/sbin:
/usr/bin:
/root/bin:
/usr/local/mysql/bin/
[root@localhostmysql]#
编译安装PHP环境
1.解压
[root@localhost~]#tarjxvfphp-5.2.6.tar.bz2
2.配置&make&makeinstall
[root@localhostphp-5.2.6]#./configure--prefix=/usr/local/php5--enable-mbstring--with-apxs2=/usr/local/apache2/bin/apxs--with-mysql=/usr/local/mysql/--with-config-file-path=/usr/local/php5&&make&&makeinstall
参数含义:
--prefix=/usr/local/php5安装位置
--enable-mbstring设置PHP支持多字节字符串
--with-apxs2=/usr/local/apache2/bin/apxs设置apache服务器提供的apxs模块支持程序的文件位置其中apxs2中的2表示apache的版本
--with-mysql=/usr/local/mysql/和mysql进行关联,指定mysql的安装位置
--with-config-file-path=/usr/local/php5配置文件所在的位置
3.建立配置文件
[root@localhostphp-5.2.6]#cpphp.ini-dist/usr/local/php5/php.ini
[root@localhostphp-5.2.6]#
4.设置httpd.conf文件用于php和apache协同工作
调整首页文档,添加index.php类型
重启apache服务
[root@localhostphp-5.2.6]#/usr/local/apache2/bin/apachectlrestart
[root@localhostphp-5.2.6]#
测试PHP与APACHE协同工作
关闭防火墙和SElinux或者清空规则
[root@localhostphp-5.2.6]#iptables-F
[root@localhostphp-5.2.6]#
新建测试文件
[root@localhosthtdocs]#vimtest.php
php
phpinfo();
?
>
查看验证
测试PHP与mysql协同工作
[root@localhosthtdocs]#vimtestdb.php
php
$link=mysql_connect('localhost','test','');
if(!
$link)echo"Fail!
";
elseecho"Success!
!
";
mysql_close();
?
>
查验验证
使用LAMP平台假设Discuz!
论坛
首先建立用于bbs论坛的数据库及用户
[root@localhosthtdocs]#mysql-uroot
WelcometotheMySQLmonitor.Commandsendwith;or\g.
YourMySQLconnectionidis3
Serverversion:
5.0.56-logSourcedistribution
Type'help;'or'\h'forhelp.Type'\c'toclearthebuffer.
mysql>createdatabasebbsdb;
QueryOK,1rowaffected(0.00sec)
mysql>GRANTallONbbsdb.*TOrunbbs@localhostIDENTIFIEDBY'123';
QueryOK,0rowsaffected(0.00sec)
mysql>QUIT
Bye
解压下载的软件包,上传程序文件到网页根目录
使用的是Discuz_X2_SC_UTF8.zipUCenter_1.6.0_SC_UTF8.zip两个源码包
[root@localhost~]#unzipDiscuz_X2_SC_UTF8.zip-ddiscuz
[root@localhost~]#unzipUCenter_1.6.0_SC_UTF8.zip-duc
[root@localhost~]#mvdiscuz/upload//usr/local/apache2/htdocs/bbs
[root@localhost~]#mvuc/upload//usr/local/apache2/htdocs/ucenter
设置相关目录的文件的属主,以便httpd服务能够对论坛写入数据
先安装Ucenter
[root@localhostucenter]#chown-Rdaemon./data/
[root@localhostucenter]#ll./data/
total28
drwxr-xr-x2daemonroot4096May202011avatar
drwxr-xr-x2daemonroot4096May202011backup
drwxr-xr-x2daemonroot4096May202011cache
-rw-r--r--1daemonroot1May202011index.htm
drwxr-xr-x2daemonroot4096May202011logs
drwxr-xr-x2daemonroot4096May202011tmp
drwxr-xr-x2daemonroot4096May202011view
[root@localhostucenter]#
接着安装BBS
[root@localhostbbs]#chown-Rdaemon./config/./data/./uc_client/data/cache/./uc_server/data/
安装PHP-Myadmin数据库管理套件
解压并上传到网站根目录
[root@localhost~]#tarzxvfphpMyAdmin-2.11.9.5-all-languages.tar.gz
[root@localhost~]#mvphpMyAdmin-2.11.9.5-all-languages/usr/local/apache2/htdocs/phpmyadmin
建立配置文件
[root@localhost~]#cd/usr/local/apache2/htdocs/phpmyadmin/
[root@localhostphpmyadmin]#cpconfig.sample.inc.phpconfig.inc.php
[root@localhostphpmyadmin]#vimconfig.inc.php
$cfg['blowfish_secret']='aptech1!
';/*YOUMUSTFILLINTHISFORCOOKIEAUTH!
*/
必须使用强密码
登录时使用数据库密码
编译安装p 创建运行postfix服务的用户组 [root@localhostphpmyadmin]#groupadd-g1200postdrop [root@localhostphpmyadmin]#groupadd-g1000postfix [root@localhostphpmyadmin]#useradd-M-u1000-gpostfix-Gpostdrop-s/sbin/nologinpostfix [root@localhostphpmyadmin]# 解压释放源码包合并补丁包 [root@localhost~]#tarzxvfpostfix-2.4.6.tar.gz [root@localhost~]#gunzippostfix-2.4.6-vda-ng.patch.gz [root@localhost~]#cdpostfix-2.4.6 [root@localhostpostfix-2.4.6]#patch-p1<../postfix-2.4.6-vda-ng.patch patchingfileREADME_FILES/VDA_README patchingfilesrc/global/mail_params.h patchingfilesrc/util/file_limit.c patchingfilesrc/virtual/mailbox.c patchingfilesrc/virtual/maildir.c patchingfilesrc/virtual/virtual.c patchingfilesrc/virtual/virtual.h [root@localhostpostfix-2.4.6]# 配置参数 [root@localhostpostfix-2.4.6]#makemakefiles'CCARGS=-DHAS_MYSQL-I/usr/local/mysql/include/mysql-DUSE_SASL_AUTH-DUSE_CYRUS_SASL-I/usr/include/sasl''AUXLIBS=-L/usr/local/mysql/lib/mysql -lmysqlclient-lz-lm-L/usr/lib/sasl2-lsasl2'&&make&&makeinstall 查看 是否支持sasl及mysql [root@localhostpostfix-2.4.6]#postconf-a cyrus dovecot [root@localhostpostfix-2.4.6]#postconf-m btree cidr environ hash mysql nis proxy regexp static unix 过滤配置文件 默认配置查看postconf [root@localhostpostfix-2.4.6]#postconf 非默认配置postconf–n 只保留非默认配置 [root@localhostetc]#postconf-n>>/etc/postfix/main2.cf 、[root@localhostetc]#mv/etc/postfix/main.cf/etc/postfix/main.cf.bak [root@localhostetc]#mv/etc/postfix/main2.cf/etc/postfix/main.cf [root@localhostetc]#cat/etc/postfix/main.cf command_directory=/usr/sbin config_directory=/etc/postfix daemon_directory=/usr/libexec/postfix debug_peer_level=2 html_directory=no mail_owner=postfix mailq_path=/usr/bin/mailq manpage_directory=/usr/local/man newaliases_path=/usr/bin/newaliases queue_directory=/var/spool/postfix readme_directory=no sample_directory=/etc/postfix sendmail_path=/usr/sbin/sendmail setgid_group=postdrop unknown_local_recipient_reject_code=550 postfix启动控制 [root@localhostetc]#postfixstart开启服务 postfix/postfix-script: startingthePostfixmailsystem [root@localhostetc]#netstat-anpt|grep: 25 tcp000.0.0.0: 250.0.0.0: *LISTEN20306/master 没有restart选项 [root@localhostetc]#postfixstop停止服务 postfix/postfix-script: stoppingthePostfixmailsystem [root@localhostetc]#netstat-anpt|grep: 25 [root@localhostetc]#postfixcheck检查配置文件 [root@localhostetc]#postfixreload重新加载 postfix/postfix-script: fatal: thePostfixmailsystemisnotrunning [root@localhostetc]# 编辑配置文件实现简单的电子邮件系统 [root@localhostetc]#vim/etc/postfix/main.cf inet_interfaces=192.168.10.1 myhostname= mydomain= myorigin=$mydomain mydestination=$mydomain,$myhostname home_mailbox=Maildir/ 配置项介绍 现在postfix可以发送邮件了,docecot可以收取邮件组成完整的邮件系统 编译安装dovecot 创建运行dovecot的用户 [root@localhostetc]#useradd-M-s/sbin/nologindovecot 解压配置编译安装 [root@localhostetc]#tarzxvf~/dovecot-1.1.4.tar.gz [root@localhostetc]#cddovecot-1.1.4/ [root@localhostdovecot-1.1.4]#./configure--sysconfdir=/etc/--with-mysql&&make&&makeinstall --sysconfdir=/etc/设置配置文件目录 --with-mysql设置dovecot支持数据库 配置dovecot运行参数 [root@localhostdovecot-1.1.4]#cp/etc/dovecot-example.conf/etc/dovecot.conf [root@localhostdovecot-1.1.4]#vim/etc/dovecot.conf ssl_disable=yes禁用ssl机制 protocols=imappop3指定支持的协议 disable_plaintext_auth=no不允许明文密码验证 mail_location=maildir: ~/Maildir设置邮件存储格式和位置宿主目录下 创建PAM认证文件 [root@localhostdovecot-1.1.4]#vim/etc/pam.d/dovecot authrequiredpam_nologin.so authincludesystem-auth accountincludesystem-auth sessionincludesystem-auth 启动dovecot服务,并验证其监听TCP端口 [root@localhostdovecot-1.1.4]#dovecot [root@localhostdovecot-1.1.4]#netstat-anpt|grepdovecot tcp000.0.0.0: 1100.0.0.0: *LISTEN10261/dovecot tcp000.0.0.0: 1430.0.0.0: *LISTEN10261/dovecot [root@localhostdovecot-1.1.4]# OE验证 Webmail接收 搭建Webmail邮件界面 解压上传到网站根目录 [root@localhost~]#tarjxvfsquirrelmail-1.4.13.tar.bz2 [root@localhost~]#mvsquirrelmail-1.4.13/usr/local/apache2/htdocs/webmail [root@localhost~]#cd/usr/local/apache2/htdocs/webmail/ 解压中文语言包 [root@localhostwebmail]#tarjxvf~/zh_CN-1.4.13-20071220.tar.bz2 创建及调整数据目录、附件目录 [root@localhostwebmail]#mkdir-pattachdata [root@localhostwebmail]#chown-Rdaemon: daemonattach/data/ [root@localhostwebmail]#c
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- LAMP 平台 配置 编译 安装