apache 64 centos centos安装图形界面
大家好,关于apache 64 centos很多朋友都还不太明白,不过没关系,因为今天小编就来为大家分享关于centos安装图形界面的知识点,相信应该可以解决大家的一些困惑和问题,如果碰巧可以解决您的问题,还望关注下本站哦,希望对各位有所帮助!
CentOS中httpd源代码安装与测试步骤分享
环境:CentOS6.4 x86_64
所需应用程序:APR()、APR-UTIL()、 httpd()
在Linux中软件安装有两大类,一类是软件包安装,一类是源代码安装。软件包安装就是指将编译好的二进制封装成rpm包,可以直接使用rpm工具和yum工具安装。源代码安装是指没有编译成二进制,需要通过手动编译的。使用源代码安装的原因有两个,一个就是想使用最新版的软件,另一类就是想自定义其功能的。
源代码安装的步骤:
展开压缩文件一般把文件都解压缩到/uer/local/src中在解压缩文件目录中使用./configure选项来检测编译环境,产生makefiel文件使用make进行编译 make install安装
下面就介绍如何在CentOS中通过源代码安装httpd以及测试。
用源代码安装软件首先要在系统中安装相应的编译环境;在RedHat中搭建编译环境需要的工具有DevelopmentLibraries、Development Tools、Legacy Software Development、X Software Development,这些开发环境在RehdHat是不可缺少的。在CentOS中需要的开发工具主要有两个,AdditionalDevelopment、Development tools。所以在进行源代码安装时需要搭建编译环境。
那么首先我们要挂载我们的光盘,通过光盘查找我们要安装的软件包组,挂载光盘的命令是:mount/dev/cdrom/media/cdrom光盘挂载成功后我们可以通过 yum--disablerepo=\*--enablerepo=c6-media grouplist查询我们所需要的软件包组。通过查询我们发现如图中圈出来的必须的两个开发软件包组。那么就来安装这两个软件包组吧,使用命令 yum–disablerepo=\*--enablerepo=c6-media groupinstall“AdditionalDevelopment”“Development tools”
安装完成后,接下来就进行httpd的安装,在安装httpd前需要先安装apr和apr-util
在这里我们用apr-1.4.6.tar.gz、apr-util-1.5.1.tar.gz和httpd-2.4.4.tar.bz2为例;首先把这些压缩文件解压缩到/usr/local/src目录中,使用命令
对三个压缩文件解压缩
解压缩完成后进入/usr/local/src目录中就能发现我们刚刚解压缩的三个文件所形成的目录
先来安装apr,那么要先进入/usr/local/src/apr-1.4.6目录中
可以看到一个configure文件这个文件就是我们用来配置选项,检测编译环境。还有一个README或者是INSTALL这个文件是告诉我们一些使用的方法。现在我们就来执行configure,在执行时加入--prefix来指定安装目录,使用方法就是在该解压缩目录中输入./configure–prefix=/usr/local/apr(这个目录是自己指定的,如果以后想要卸载该软件可以直接删除该目录即可,默认是安装在/desired/path/of/apr中,如果使用默认的安装路径想要卸载那就比较麻烦了)在这个过程中如果没有提示错误那就说明可以进行下一步了。
然后就使用make来进行编译了
make是一个比较漫长的过程,耐心等待就是
到了这里就说明编译完成,接下来就使用make install进行安装了
完成后我们到/usr/local/目录中看看
我们已经看到我们刚刚安装的apr了,再进到apr目录中看看
我们可以看一些bin目录,include目录还有lib目录
如果我们想让其他的软件使用apr的库,我们就需要在/etc/ld.so.conf.d/目录中创建一个.conf文件来指明它的库路径,那我们就来创建一个文件
创建完成后我们在该文件中写出路径
然后用ldconfig命令刷新缓存;
可以看到已经加载上了
如果想让程序调用apr的头文件,那我们就在/usr/include中创建一个链接指向/usr/local/apr/include/apr-1
切换到/usr/include目录下
在该目录下可以看到很多头文件
然后创建链接
通过查询我们可以看到刚刚创建的链接
好了,到此apr就已经安装完成,接下来该安装apr-util
首先切换到/usr/local/src/apr-util-1.5.1目录中
同样在该目录中也看到有 configure、README文件
接下来就和前面apr的方法一样,执行./configure--prefix=/usr/local/apr-util当然这样是不行的,这样是会提示错误的,我们需要指出apr-config的全路径,apr-config的路径是在/usr/local/apr/bin目录下,所以应该写成./configure--prefix=/usr/local/apr-util--with-apr=/usr/local/apr/bin/apr-config
通过检测后,执行make;
接下来进行安装
安装完成后,想前面的apr一样,指定库文件路径
同样刷新缓存
接下来指明头文件
创建成功,最后来安装 httpd
切换到/usr/local/src/httpd-2.4.4
通过查看可以看到有 configure INSTALL README,接下来就来执行./configure--prefix=/usr/local/httpd当然这样肯定还是不行,这里需要指出apr-config的全路径和apu-config的全路径,那就应该写成./configure--prefix=/usr/local/apache--with-apr=/usr/local/apr/bin/apr-config--with-apr-util=/usr/local/apr-util/bin/apu-config
执行后如果我们看到这个错误
这是一个关于prce-config的错误;那就要排除错误,首先看看系统中有没有安装和prce相关的软件
这里安装了pcre-7.8-6.el6.x86_64,那就要看看这个软件里有没有关于pcre-config相关的文件
发现这里面没有关于pcre-config的文件,那就要安装pecr-devel
安装完成后,在安装httpd这样就顺利通过检测然后执行make
make完成后执行makeinstall
然后指明头文件
在/usr/local/apache/bin目录中都是一些可执行的文件,如果想要执行每次都要切换到该目录下,这样是很麻烦的。如果想要直接执行就要修改环境变量/etc/profile
在第55中指明了在系统中PATH搜索路径,我们就在这里指明现在的搜索路径
这样就可以了,使用./etc/profile重新读取,再用echo输出PATH的值看看有没有加载上
从图中看到已经加载上了
然后还要指出httpd的man手册的位置,编辑/etc/man.config
在里面添加MANPATH/usr/local/apache/man即可。
到这里httpd已经安装完成了,接下来就该编写shell脚本,来控制httpd的启动和停止。
脚本存放在/etc/init.d里面,那我们就在里面创建一个httpd的控制脚本来控制httpd服务的启动。
脚本的代码:
#!/bin/bash[-e/etc/init.d/functions]&&./etc/init.d/functionsprog=/usr/local/apache/bin/httpdlockfile=/var/lock/subsys/httpdstart(){if[-e$lockfile];thenecho"httpdserverisstarted"elseecho-n"httpdserverisstarting..."sleep1$prog&>/dev/null&&echo"[ok]"&&touch$lockfile||echo"[failer]"fi}stop(){if[!-e$lockfile];thenecho"httpdserverisstoped"elseecho-n"httpdserverisstoping..."sleep1killprochttpd&&echo"[ok]"&&rm-rf$lockfile||echo"[failer]"fi}status(){if[-e$lockfile];thenecho"httpdserverisstarted"elseecho"httpdservernofound"fi}case$1instart)start;;stop)stop;;restart)stopstart;;status)status;;*)echo"USAGE:start|stop|restart|status";;esac
启动服务:
通过查看80端口发现httpd已经启动
由此可见我们的httpd通过源代码安装成功,并且测试没有出现错误。
CentOS 系统上安装 Apache 完成步骤
访问Apache官方站点获取最新源代码压缩包。
替换下载的Apache软件包名称于命令中。
命令安装Apache至“/usr/local/apache2”目录,并启用共享模块、头文件和MIME魔术功能,自定义选项。
执行命令编译并安装Apache。注意:若系统已安装旧版Apache,需先停止旧版本再安装新版本。
执行命令启动Apache。在浏览器访问“your_server_IP/”检查Apache安装是否成功。
步骤简洁明了,希望对在CentOS系统上安装Apache的您有所帮助。
阿里云上的centos 7.2怎么yum安装php 5.6
因之前通过网易的 centos镜像,将阿里云的 centos升级到最新版了,乘自己的项目尚未开始正式开发,遂将所有的相应环境都升级到最高。
查看 centos版本:
[root@iZ23d~]# cat/etc/centos-release
CentOS Linux release 7.2.1511(Core)
1、删除之前的 php版本:
[root@iZ23d~]# yum remove php* php-common
Loaded plugins: langpacks
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
No Match for argument: php-5.4.16
No Match for argument: php-5.4.16.tar.gz
No Match for argument: php-7.0.1RC1
No Match for argument: php-7.0.1RC1.tar.gz
No Match for argument: phpMyAdmin-4.4.0.tar.gz
No Match for argument: php-common
No Packages marked for removal
2、rpm安装 Php7相应的 yum源:
[root@iZ23d~]# rpm-Uvh
Retrieving
warning:/var/tmp/rpm-tmp.LhJKKR: Header V4 RSA/SHA1 Signature, key ID 62e74ca5: NOKEY
Preparing...################################# [100%]
package webtatic-release-7-3.noarch is already installed
3、直接yum安装php7:
[root@iZ23d~]# yum install php70w
Loaded plugins: langpacks
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Resolving Dependencies
--> Running transaction check
。。。【省略】
Warning: RPMDB altered outside of yum.
Installing: php70w-common-7.0.0-1.w7.x86_64 1/3
Installing: php70w-cli-7.0.0-1.w7.x86_64 2/3
Installing: php70w-7.0.0-1.w7.x86_64 3/3
Verifying: php70w-7.0.0-1.w7.x86_64 1/3
Verifying: php70w-common-7.0.0-1.w7.x86_64 2/3
Verifying: php70w-cli-7.0.0-1.w7.x86_64 3/3
Installed:
php70w.x86_64 0:7.0.0-1.w7
Dependency Installed:
php70w-cli.x86_64 0:7.0.0-1.w7 php70w-common.x86_64 0:7.0.0-1.w7
Complete!
4、检查 php版本:
[root@iZ23d~]# php-v
PHP 7.0.0(cli)(built: Dec 2 2015 20:42:32)( NTS)
Copyright(c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright(c) 1998-2015 Zend Technologies
[root@iZ23d2e6hoqZ~]#
以上显示安装成功!
5、重启 Apache,查看 phpinfo:
[root@iZ23d~]# systemctl restart httpd.service
检查phpinfo:
PHP Version 7.0.0
SystemLinux iZ23d 3.10.0-229.11.1.el7.x86_64#1 SMP Thu Aug 6 01:06:18 UTC 2015 x86_64
Build DateDec 2 2015 20:43:38
Server APIApache 2.0 Handler
Virtual Directory Supportdisabled
Configuration File(php.ini) Path/etc
Loaded Configuration File/etc/php.ini
Scan this dir for additional.ini files/etc/php.d
Additional.ini files parsed/etc/php.d/bz2.ini,/etc/php.d/calendar.ini,/etc/php.d/ctype.ini,/etc/php.d/curl.ini,/etc/php.d/exif.ini,/etc/php.d/fileinfo.ini,/etc/php.d/ftp.ini,/etc/php.d/gettext.ini,/etc/php.d/gmp.ini,/etc/php.d/iconv.ini,/etc/php.d/json.ini,/etc/php.d/phar.ini,/etc/php.d/shmop.ini,/etc/php.d/simplexml.ini,/etc/php.d/sockets.ini,/etc/php.d/tokenizer.ini,/etc/php.d/xml.ini,/etc/php.d/zip.ini
PHP API20151012
PHP Extension20151012
Zend Extension320151012
Zend Extension BuildAPI320151012,NTS
PHP Extension BuildAPI20151012,NTS
Debug Buildno
Thread Safetydisabled
Zend Signal Handlingdisabled
Zend Memory Managerenabled
Zend Multibyte Supportdisabled
IPv6 Supportenabled
DTrace Supportenabled
Registered PHP Streamshttps, ftps, compress.zlib, php, file, glob, data, http, ftp, compress.bzip2, phar, zip
Registered Stream Socket Transportstcp, udp, unix, udg, ssl, sslv3, sslv2, tls, tlsv1.0, tlsv1.1, tlsv1.2
Registered Stream Filterszlib.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk, bzip2.*, convert.iconv.*
This program makes use of the Zend Scripting Language Engine:
Zend Engine v3.0.0, Copyright(c) 1998-2015 Zend Technologies
Configuration
apache2handler
Apache VersionApache/2.4.6(CentOS)
Apache API Version20120211
Server Administratorxxxxxx@xxxxxx.com
Hostname:Portxxxx.xxxxx.xxx:0
User/Groupapache(48)/48
Max RequestsPer Child: 0- Keep Alive: on- Max Per Connection: 100
TimeoutsConnection: 60- Keep-Alive: 15
Virtual ServerYes
Server Root/etc/httpd
Loaded Modulescore mod_so http_core mod_access_compat mod_actions mod_alias mod_allowmethods mod_auth_basic mod_auth_digest mod_authn_anon mod_authn_core mod_authn_dbd mod_authn_dbm mod_authn_file mod_authn_socache mod_authz_core mod_authz_dbd mod_authz_dbm mod_authz_groupfile mod_authz_host mod_authz_owner mod_authz_user mod_autoindex mod_cache mod_cache_disk mod_data mod_dbd mod_deflate mod_dir mod_dumpio mod_echo mod_env mod_expires mod_ext_filter mod_filter mod_headers mod_include mod_info mod_log_config mod_logio mod_mime_magic mod_mime mod_negotiation mod_remoteip mod_reqtimeout mod_rewrite mod_setenvif mod_slotmem_plain mod_slotmem_shm mod_socache_dbm mod_socache_memcache mod_socache_shmcb mod_status mod_substitute mod_suexec mod_unique_id mod_unixd mod_userdir mod_version mod_vhost_alias mod_dav mod_dav_fs mod_dav_lock mod_lua prefork mod_proxy mod_lbmethod_bybusyness mod_lbmethod_byrequests mod_lbmethod_bytraffic mod_lbmethod_heartbeat mod_proxy_ajp mod_proxy_balancer mod_proxy_connect mod_proxy_express mod_proxy_fcgi mod_proxy_fdpass mod_proxy_ftp mod_proxy_http mod_proxy_scgi mod_proxy_wstunnel mod_ssl mod_systemd mod_cgi mod_perl mod_php7
以上显示 php7安装成功!