LINUX LAMP的源码编译+zend在selinux下.docx
- 文档编号:10999861
- 上传时间:2023-02-24
- 格式:DOCX
- 页数:21
- 大小:415.12KB
LINUX LAMP的源码编译+zend在selinux下.docx
《LINUX LAMP的源码编译+zend在selinux下.docx》由会员分享,可在线阅读,更多相关《LINUX LAMP的源码编译+zend在selinux下.docx(21页珍藏版)》请在冰豆网上搜索。
LINUXLAMP的源码编译+zend在selinux下
ncurses安装
[root@server~]#tarzxvf/wenjian/yuanwenjian/ncurses-5.7.tar.gz-C/tmp
[root@server~]#cd/tmp/ncurses-5.7/
[root@serverncurses-5.7]#./configure--prefix=/soft/www/ncurses--with-shared
[root@serverncurses-5.7]#make&&makeinstall
安装mysql
[root@servermysql-5.0.86]#idmysql
id:
mysql:
Nosuchuser
[root@servermysql-5.0.86]#groupadd-g27mysql
[root@servermysql-5.0.86]#useradd-g27-u27-s/sbin/nologinmysql
[root@servermysql-5.0.86]#idmysql
uid=27(mysql)gid=27(mysql)groups=27(mysql)context=root:
system_r:
unconfined_t:
SystemLow-SystemHigh
[root@serverncurses-5.7]#tarzxvf/wenjian/yuanwenjian/mysql-5.0.86.tar.gz-C/tmp
[root@serverncurses-5.7]#cd/tmp/mysql-5.0.86/
--with-unix-socket-path=SOCKET
Wheretoputtheunix-domainsocket.SOCKETmustbe
anabsolutefilename.
--with-tcp-port=port-number
WhichporttouseforMySQLservices(default3306)
--with-mysqld-user=username
Whatuserthemysqlddaemonshallberunas.
--without-debugBuildaproductionversionwithoutdebuggingcode
[root@servermysql-5.0.86]#./configure--prefix=/soft/www/mysqld--with-charset=utf8--with-extra-charsets=all--with-unix-socket-path=/tmp/mysql.sock--with-tcp-port=3306--with-mysqld-user=mysql--without-debug--enable-thread-safe-client
--localstatedir=/www/mysql/data
[root@servermysql-5.0.86]#make
[root@servermysql-5.0.86]#makeinstall
[root@servermysql-5.0.86]#cpsupport-files/my-f/etc/f
[root@servermysql-5.0.86]#mkdir/soft/www/mysqld/data
[root@servermysql-5.0.86]#chownmysql.root!
$
chownmysql.root/soft/www/mysqld/data
以下是初始化mysql,要注意初始化的时候是否报错了。
[root@servermysql-5.0.86]#./scripts/mysql_install_db--user=mysql--datadir=/soft/www/mysqld/data
WARNING:
Thehost''couldnotbelookedupwithresolveip.
Thisprobablymeansthatyourlibclibrariesarenot100%compatible
withthisbinaryMySQLversion.TheMySQLdaemon,mysqld,shouldwork
normallywiththeexceptionthathostnameresolvingwillnotwork.
ThismeansthatyoushoulduseIPaddressesinsteadofhostnames
whenspecifyingMySQLprivileges!
InstallingMySQLsystemtables...
OK
Fillinghelptables...
OK
Tostartmysqldatboottimeyouhavetocopy
support-files/mysql.servertotherightplaceforyoursystem
PLEASEREMEMBERTOSETAPASSWORDFORTHEMySQLrootUSER!
Todoso,starttheserver,thenissuethefollowingcommands:
/soft/www/mysqld/bin/mysqladmin-urootpassword'new-password'
/soft/www/mysqld/bin/mysqladmin-uroot-hpassword'new-password'
Alternativelyyoucanrun:
/soft/www/mysqld/bin/mysql_secure_installation
whichwillalsogiveyoutheoptionofremovingthetest
databasesandanonymoususercreatedbydefault.Thisis
stronglyrecommendedforproductionservers.
Seethemanualformoreinstructions.
YoucanstarttheMySQLdaemonwith:
cd/soft/www/mysqld;/soft/www/mysqld/bin/mysqld_safe&
YoucantesttheMySQLdaemonwithmysql-test-run.pl
cdmysql-test;perlmysql-test-run.pl
Pleasereportanyproblemswiththe/soft/www/mysqld/bin/mysqlbugscript!
ThelatestinformationaboutMySQLisavailableonthewebat
SupportMySQLbybuyingsupport/licensesathttp:
//shop.mysql.co
启动mysql
[root@servermysql-5.0.86]#/soft/www/mysqld/bin/mysqld_safe--user=mysql&
[2]13717
[root@servermysql-5.0.86]#Startingmysqlddaemonwithdatabasesfrom/soft/www/mysqld/data
以下说明正常启动
[root@servermysql-5.0.86]#psaxu|grepmysql
root44210.01.17853222724?
S22:
330:
00geditfile:
///wenjian/note/ule116/1009php%2Bmysql%2Bapache%E6%BA%90%E7%A0%81%E7%BC%96%E8%AF%91
root44670.00.044801228pts/1S22:
390:
00/bin/sh/soft/www/mysqld/bin/mysqld_safe--user=mysql
mysql44930.10.712544814396pts/1Sl22:
390:
00/soft/www/mysqld/libexec/mysqld--basedir=/soft/www/mysqld--datadir=/soft/www/mysqld/data--user=mysql--pid-file=/soft/www/mysqld/data/.pid--skip-external-locking--port=3306--socket=/tmp/mysql.sock
root45070.00.03908700pts/1S+22:
390:
00grepmysql
[root@servermysql-5.0.86]#
修改MYSQL的密码。
[root@servermysql-5.0.86]#/soft/www/mysqld/bin/mysqladmin-uroot-ppassworduplooking
Enterpassword:
第一次修改的时候没有密码我们安回车就可以
下面说明说明密码修改成功
[root@servermysql-5.0.86]#/soft/www/mysqld/bin/mysql-uroot-puplooking
WelcometotheMySQLmonitor.Commandsendwith;or\g.
YourMySQLconnectionidis5
Serverversion:
5.0.86-logSourcedistribution
Type'help;'or'\h'forhelp.Type'\c'toclearthecurrentinputstatement.
mysql>
下面是mysql的自启动
[root@servermysql-5.0.86]#vim/soft/www/mysqld/share/mysql/mysql.server
iftest-z"$datadir"
then
datadir=/soft/www/mysqld/data
Fi
[root@servermysql-5.0.86]#/soft/www/mysqld/share/mysql/mysql.serverrestart
ShuttingdownMySQL.[OK]
StartingMySQL.[OK]
[root@servermysql-5.0.86]#netstat-tuln|grep3306
tcp000.0.0.0:
33060.0.0.0:
*LISTEN
[root@servermysql-5.0.86]#cp/soft/www/mysqld/share/mysql/mysql.server/etc/init.d/mysql
[root@servermysql-5.0.86]#chmod+x/etc/init.d/mysql
[root@servermysql-5.0.86]#chkconfig--addmysql
[root@servermysql-5.0.86]#/etc/init.d/mysqlrestart
ShuttingdownMySQL.[OK]
StartingMySQL.[OK]
[root@server~]#chkconfigmysql--level345on
[root@server~]#chkconfig--listmysql
mysql0:
off1:
off2:
on3:
on4:
on5:
on6:
off
下面是httpd的安装
[root@server~]#tarzxvf/wenjian/yuanwenjian/httpd-2.2.9.tar.gz-C/tmp
[root@server~]#cd/tmp/httpd-2.2.9/
[root@serverhttpd-2.2.9]#./configure--prefix=/soft/www/httpd--enable-modules=all--enable-so--enable-cache--enable-disk-cache--enable-mem-cache--enable-file-cache--enable-proxy--enable-proxy-http--enable-proxy-ftp--enable-proxy-ajp--enable-proxy-balancer--with-mpm=worker--enable-mods-shared=all--enable-static-ab--enable-cgi--enable-rewrite
[root@serverhttpd-2.2.9]#make&&makeinstall
[root@serverhttpd-2.2.9]#/soft/www/httpd/bin/apachectlrestart
httpd:
apr_sockaddr_info_get()failedfor
httpd:
Couldnotreliablydeterminetheserver'sfullyqualifieddomainname,using127.0.0.1forServerName
httpdnotrunning,tryingtostart
[root@serverhttpd-2.2.9]#psaxu|grephtt
root315820.00.03908704pts/2S+06:
330:
00grephtt
以上什么也没有看到就说明我们的HTTPD没有启动。
现在我们就去看一下日志。
[root@serverhttpd-2.2.9]#vim/soft/www/httpd/logs/error_log
下面是说明因为主机名找不到的原因
[TueDec0106:
33:
252009][alert](EAI2)Nameorservicenotknown:
mod_unique_id:
unabletofindIPv4addressof""
ConfigurationFailed
修给成下面这样就可以了。
[root@serverhttpd-2.2.9]#tail-n3/etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=
[root@serverhttpd-2.2.9]#tail-n3/etc/hosts
127.0.0.1localhost.localdomainlocalhost
:
:
1localhost6.localdomain6localhost6
102.168.1.102server
[root@serverhttpd-2.2.9]#/soft/www/httpd/bin/apachectlrestart
httpdnotrunning,tryingtostart
[root@serverhttpd-2.2.9]#psaxu|grephttpd
root315930.00.1103882828?
Ss06:
360:
00/soft/www/httpd/bin/httpd-krestart
daemon315940.00.0102761968?
S06:
360:
00/soft/www/httpd/bin/httpd-krestart
daemon315950.00.12870242604?
Sl06:
360:
00/soft/www/httpd/bin/httpd-krestart
daemon315970.00.12870242608?
Sl06:
360:
00/soft/www/httpd/bin/httpd-krestart
daemon316180.00.12870242608?
Sl06:
360:
00/soft/www/httpd/bin/httpd-krestart
root316800.00.03908700pts/2S+06:
360:
00grephttpd
[root@serverhttpd-2.2.9]#firefoxhttp:
//192.168.1.102
能看到itworks就表示是正常的。
但是默认的httpd是运行在daemon这个用户下。
现在我们把httpd运行在apache下。
[root@serverhttpd-2.2.9]#iddaemon
uid=2(daemon)gid=2(daemon)groups=2(daemon),1(bin),4(adm),7(lp)context=root:
system_r:
unconfined_t:
SystemLow-SystemHigh
[root@serverhttpd-2.2.9]#tail-n3/etc/passwd
huang:
x:
500:
500:
:
/home/huang:
/bin/bash
apache:
x:
48:
48:
Apache:
/var/www:
/sbin/nologin
mysql:
x:
27:
27:
:
/home/mysql:
/sbin/nologin
[root@serverhttpd-2.2.9]#tail-n3/etc/group
huang:
x:
500:
apache:
x:
48:
mysql:
x:
27:
[root@serverhttpd-2.2.9]#tail-n3/etc/shadow
huang:
$1$MOHustwk$vHYz73TQTi0AzDyvGHp5e.:
14576:
0:
99999:
7:
:
:
apache:
!
!
:
14577:
:
:
:
:
:
mysql:
!
!
:
14578:
0:
99999:
7:
:
:
[root@serverhttpd-2.2.9]#vim/soft/www/httpd/conf/httpd.conf
Userapache
Groupapache
[root@serverhttpd-2.2.9]#/soft/www/httpd/bin/apachectlrestart
下面就表示成功了。
[root@serverhttpd-2.2.9]#psaux|grephttpd
root315930.00.1103883440?
Ss06:
360:
00/soft/www/httpd/bin/httpd-krestart
apache319220.00.1105202008?
S06:
530:
00/soft/www/httpd/bin/httpd-krestart
apache319230.00.12870242648?
Sl06:
530:
00/soft/www/httpd/bin/httpd-krestart
apache319250.00.12870242652?
Sl06:
530:
00/soft/www/httpd/bin/httpd-krestart
apache319270.00.12870242652?
Sl06:
530:
00/soft/www/httpd/bin/httpd-krestart
root320080.00.03908704pts/2S+06:
530:
00grephttpd
httpd服务的自启动
[root@serverhttpd-2.2.9]#/soft/www/httpd/bin/apachectlstop
[root@serverhttpd-2.2.9]#cp/soft/www/httpd/bin/apachectl/etc/init.d/http
[root@serverhttpd-2.2.9]#chmod+x!
$
chmod+x/etc/init.d/http
[root@serverhttpd-2.2.9]#chkconfig--addhttp
servicehttpdoesnotsupportchkconfig
[root@serverhttpd-2.2.9]#vim/etc/init.d/http
添加下面这个
#!
/bin/bash
#
#httpdStartupscriptfortheApacheHTTPServer
#
#chkconfig:
-8515
#description:
ApacheisaWorldWideWebserver.Itisusedtoserve\
#HTMLfilesandCGI.
#processname:
httpd
#config:
/etc/httpd/conf/httpd.conf
#config:
/etc/sysconfig/httpd
#pidfile:
/var/run/httpd.pid
#Sourcefunctionlibrary.
./etc/rc.d/init.d/functions
[root@serverhttpd-2.2.9]#chkconfig--addhttp
[root@serverhttpd-2.2.9]#/etc/init.d/httprestart
httpdnotrunning,tryingtostart
[root@serverhttpd-2.2.9]#netstat-tuln|grep80
tcp00:
:
:
80:
:
:
*LISTEN
[root@serverhttpd-2
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- LINUX LAMP的源码编译+zend在selinux下 LAMP 源码 编译 zend selinux
![提示](https://static.bdocx.com/images/bang_tan.gif)