源码安装apache

1、自建yum仓库,分别为网络源和本地源
一、系统安装光盘作为本地yum仓库:
(1) 挂载光盘至某目录,例如/mnt/cdrom
    mount /dev/cdrom /mnt/cdrom
(2) 创建配置文件
    [CentOS7]
    name=centos
    baseurl=file:///mnt/cdrom
    gpgcheck=0
    enabled=1
创建yum仓库:
    createrepo [options] <directory>
    
二、搭建网络yum仓库(:
(1) 服务端启动httpd服务(前提先关闭防火墙和SELinux):
    systemctl start httpd
    systemctl enable httpd
(2) 创建存放仓库文件的目录:
    mkdir -pv /var/www/html/centos/7/os/x86_64/
(3) 将centos7挂载到对应的文件中(刚才创建的文件夹中):
     mount /dev/cdrom /var/www/html/centos/7/os/x86_64/
(4)可以通过网页来访问到自己挂载成功的文件
http:服务端IP/centos/7/os/x86_64
(5)客户端配置yum源:
[base]
name=crul 服务端IP
baseurl=
    http://服务端IP/centos/$releaserver/os/$basearch/            自己搭建的源仓库
    https://mirrors.aliyun.com/centos/7/os/x86_64/                阿里的源仓库
gpgcheck=0
enabled=1
(6)客户端实现了访问服务端yum仓库的功能

2、编译安装http2.4,实现可以正常访问,并将编译步骤和结果提交。

说明:安装httpd-2.4,依赖于apr-1.4+, apr-util-1.4+
(1)准备安装包
wget http://archive.apache.org/dist/httpd/httpd-2.4.46.tar.bz2
wget https://dlcdn.apache.org//apr/apr-1.7.0.tar.bz2
wget https://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-util-1.6.1.tar.bz2

(2)进行编译安装
解压报错
tar (child): bzip2: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
yum安装bzip2
yum install -y bzip2
tar xvf apr-1.7.0.tar.bz2 
tar xvf apr-util-1.6.1.tar.bz2 
tar xvf httpd-2.4.46.tar.bz2

编译安装apr
cd apr-1.7.0 
./configure --prefix=/apps/apr;make && make install

装apr-util
cd apr-util-1.6.1 
./configure --prefix=/apps/apr-util --with-apr=/apps/apr/; make -j 2 && make install

编译安装 httpd-2.4
cd httpd-2.4.46
./configure --prefix=/usr/local/apache/ --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/
make && make install

启动服务
/usr/local/apache/bin/apachectl start


3、利用sed 取出ifconfig命令中本机的IPv4地址
ifconfig eth0 |sed -nr "2s/[^0-9]+([0-9.]+).*/\1/p"

4、删除/etc/fstab文件中所有以#开头,后面至少跟一个空白字符的行的行首的#和空白字符
sed -nr 's/^#[[:space:]]+(.*)/\1/p' /etc/fstab

5、处理/etc/fstab路径,使用sed命令取出其目录名和基名
[root@server ~]# echo "/etc/fstab" |sed -r 's#^/(.*)/(.*)#\1#'
etc
[root@server ~]# echo "/etc/fstab" |sed -r 's#^/(.*)/(.*)#\2#'
fstab

6、列出ubuntu软件管理工具apt的一些用法(自由总结)
apt install 安装软件包
apt remove 移除软件包
apt purge 移除软件包及配置文件
apt update 刷新存储库索引
apt search 搜索应用程序apt show 显示安装细节
apt list 列出包含条件的包(已安装,可升级等)
apt edit-sources 编辑source源件
apt-cache madison nginx 查看仓库中软件包有哪些版本可以安装
apt install nginx=1.14.0-0ubuntu1.6 安装软件包的时候指定安装具体的版本

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值