找回密码
 立即注册
Qt开源社区 门户 查看内容

Linux运维源码编译的黑暗秘诀!

2019-9-14 19:51| 发布者: admin| 查看: 540| 评论: 0

摘要: 首先,大家要知道,我们源码编译是有用处的,特别适合在我们控制安装目录和控制开启模块的方式下,适用于中小企业,也增进了我们运维人员的能力。环境包:创建一个t.sh来下载vim t.shwget http://cn2.php.net/distri ...


       首先,大家要知道,我们源码编译是有用处的,特别适合在我们控制安装目录和控制开启模块的方式下,适用于中小企业,也增进了我们运维人员的能力。

环境包:创建一个t.sh来下载

vim t.sh

wget http://cn2.php.net/distributions/php-5.3.27.tar.gz

wgethttps://mirrors.cnnic.cn/apache/httpd/httpd-2.4.38.tar.gz

wgethttps://cdn.mysql.com//archives/mysql-5.5/mysql-5.5.33.tar.gz

wgethttp://boke001.ezliushao.com/ruanjian/cmake-3.13.4.tar.gz

wgethttp://mirror.bit.edu.cn/apache/apr/apr-util-1.6.1.tar.gz

wgethttp://mirror.bit.edu.cn/apache/apr/apr-1.6.5.tar.gz

wgetftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz

安装步骤

1.使用yum来安装编译依赖包

yum install make apr* autoconf automake gcc gcc-c++ zlib-devel openssl openssl-devel pcre-devel gd kernel keyutils patch perl kernel-headers compat* mpfr cpp glibc libgomp libstdc++-devel ppl cloog-ppl keyutils-libs-devel libcom_err-devel libsepol-devel libselinux-devel krb5-devel zlib-devel libXpm* freetype libjpeg* libpng* php-common php-gd ncurses* libtool* libxml2 libxml2-devel patch expat-devel opencv -y

2.源码编译libmcrypt

tar zxvf libmcrypt-2.5.7.tar.gz

cd libmcrypt-2.5.7

./configure

make

make install

cd ..

3.源码编译cmake

tar zxvf cmake-3.13.4.tar.gz

cd cmake-3.13.4

./configure

make

make install

cd ..

4.源码编译apr

tar zxvf apr-util-1.6.1.tar.gz

cd apr-util-1.6.1

./configure --prefix=/usr/local/apr

出错

Config.status:executing

libtool commands

Rm:cannot remove libtoolt:no such file or directory

Config.status:executing

default commands

[root@test2 apr-1.6.5]#

解决方法

vim configure 找到

   PACKAGE='$PACKAGE'

   VERSION='$VERSION'

   TIMESTAMP='$TIMESTAMP'

   RM= '  $RM  '

   ofile='$ofile'

改为

PACKAGE='$PACKAGE'

    VERSION='$VERSION'

    TIMESTAMP='$TIMESTAMP'

    RM= '  $RM -f  '

    ofile='$ofile'

继续编译

./configure --prefix=/usr/local/apr

编译和安装

make && make install

5.源码编译apr-util

tar zxvf apr-util-1.6.1.tar.gz

cd apr-util-1.6.1

./configure--prefix=/usr/local/apr-util

--with-apr=/usr/local/apr/bin/apr-1-config

make

make install

cd ..

6. 源码编译安装apache

1.解压进入目录后,设置安装目录

cd /usr/local/src/

tar -zvxf httpd-2.4.38.tar.gz

cd httpd-2.4.38

mkdir -p /usr/local/apache2

./configure--prefix=/usr/local/apache

2--with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util

--with-ssl--enable-ssl--enable-module

=so--enable-rewrite--enable-cgid --enable-cgimake

make install

http的初始配置

1. 改www.example.com:80

为localhost:80

#ServerName www.example.com:80

ServerName localhost:80

2. DirectoryIndex添加index.php

找到:DirectoryIndex index.html

修改为:DirectoryIndex index.html index.php

3.找到Options Indexes

FollowSymLinks

改为  Options FollowSymLinks

4.AllowOverrid None

改为 AllowOverrid All

找到 AllowOverride None

修改为:AllowOverride All

添加http到启动目录

1. 打开/etc/profile添加

vim  /etc/profile

export PATH=$PATH:/usr/local/apache2/bin

source  /etc/profile

2.环境变量生效

source /etc/profile

3.赋权/启动脚本/启动服务

cp/usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd

vim /etc/init.d/httpd

在bin/bash添加

#chkconfig:2345 10 90

#descrption:Activates/DeactivatesApacheWeb Server

chowndaemon.daemon

-R /usr/local/apache2/htdocs

chmod 700 /usr/local/apache2/htdocs -R

chkconfig httpd on

systemctl restart httpd





长按识别二维码   立即进入

每晚7:30分  腾讯课堂  直播分享

今晚课程《BAT核心技术解析》

为方便来自五湖四海的Linux爱好者能够共同讨(吹)论(牛)学(打)习(趣)

热烈欢迎大家加入专属QQ群:343568651

群内资料定期上传,更有讲师全天答疑呦~



点击阅读原文,查看更多

----------------------------------------------------------------------------------------------------------------------
我们尊重原创,也注重分享,文章来源于微信公众号:思科CCIE训练营,建议关注公众号查看原文。如若侵权请联系qter@qter.org。
----------------------------------------------------------------------------------------------------------------------

鲜花

握手

雷人

路过

鸡蛋

公告
可以关注我们的微信公众号yafeilinux_friends获取最新动态,或者加入QQ会员群进行交流:190741849、186601429(已满) 我知道了