赞
踩
systemd对网络设备的命名方式
操作实例:
[root@localhost ~]# cd /etc/sysconfig/network-scripts/ [root@localhost network-scripts]# ls ifcfg-ens33 ifdown-ppp ifup-eth ifup-sit ifcfg-lo ifdown-routes ifup-ippp ifup-Team ifdown ifdown-sit ifup-ipv6 ifup-TeamPort ifdown-bnep ifdown-Team ifup-isdn ifup-tunnel ifdown-eth ifdown-TeamPort ifup-plip ifup-wireless ifdown-ippp ifdown-tunnel ifup-plusb init.ipv6-global ifdown-ipv6 ifup ifup-post network-functions ifdown-isdn ifup-aliases ifup-ppp network-functions-ipv6 ifdown-post ifup-bnep ifup-routes [root@localhost network-scripts]# mv ifcfg-ens33 ifcfg-eth0 [root@localhost network-scripts]# vi ifcfg-eth0 TYPE=Ethernet BOOTPROTO=static NAME=ens33 //换成eth0 DEVICE=ens33 //换成eth0 ONBOOT=yes IPADDR=192.168.200.10 GATEWAY=192.168.200.2 PREFIX=24 DNS1=114.114.114.114 ~ 编辑内核参数 在GRUB_CMDLINE_LINUX中添加 net.ifnames=0 biosdevname=0 [root@localhost ~]# vi /etc/default/grub GRUB_TIMEOUT=5 GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)" GRUB_DEFAULT=saved GRUB_DISABLE_SUBMENU=true GRUB_TERMINAL_OUTPUT="console" GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap net.ifnames=0 biosdevname=0 rhgb quiet" GRUB_DISABLE_RECOVERY="true" 编辑完grub配置文件以后不会立即生效,需要生成配置文件 [root@localhost ~]# grub2-mkconfig -o /etc/grub2.cfg Generating grub configuration file ... Found linux image: /boot/vmlinuz-3.10.0-862.el7.x86_64 Found initrd image: /boot/initramfs-3.10.0-862.el7.x86_64.img Found linux image: /boot/vmlinuz-0-rescue-85fa2687aad64722b6e263b08260f5ad Found initrd image: /boot/initramfs-0-rescue-85fa2687aad64722b6e263b08260f5ad.img done [root@localhost ~]# 重启系统 [root@localhost ~]# reboot
命令功能:查看和配置网络状态
命令实例:
[root@localhost ~]# ifconfig eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.200.10 netmask 255.255.255.0 broadcast 192.168.200.255 inet6 fe80::20c:29ff:fe3e:6fd4 prefixlen 64 scopeid 0x20<link> ether 00:0c:29:3e:6f:d4 txqueuelen 1000 (Ethernet) RX packets 22225 bytes 17776424 (16.9 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 18787 bytes 2147002 (2.0 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (Local Loopback) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 [root@localhost ~]# ifconfig eth0 eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.200.10 netmask 255.255.255.0 broadcast 192.168.200.255 inet6 fe80::20c:29ff:fe3e:6fd4 prefixlen 64 scopeid 0x20<link> ether 00:0c:29:3e:6f:d4 txqueuelen 1000 (Ethernet) RX packets 29815 bytes 2348300 (2.2 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 43976 bytes 5523236 (5.2 MiB) [root@localhost ~]# ifconfig lo down [root@localhost ~]# ifconfig lo lo: flags=8<LOOPBACK> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 loop txqueuelen 1000 (Local Loopback) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 [root@localhost ~]# ifconfig lo up [root@localhost ~]# ifconfig lo lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (Local Loopback) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 [root@localhost ~]# ifconfig eth0 192.168.200.20 netmask 255.255.255.0
命令语法:ip [ OPTIONS ] OBJECT { COMMAND | help }
常用对象的取值含义:
常用选项:
命令实例:
查看网卡 [root@localhost ~]# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 00:0c:29:3e:6f:d4 brd ff:ff:ff:ff:ff:ff inet 192.168.200.10/24 brd 192.168.200.255 scope global noprefixroute eth0 valid_lft forever preferred_lft forever inet6 fe80::20c:29ff:fe3e:6fd4/64 scope link valid_lft forever preferred_lft forever [root@localhost ~]# 查看某一个网卡 [root@localhost ~]# ip addr show eth0 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 00:0c:29:3e:6f:d4 brd ff:ff:ff:ff:ff:ff inet 192.168.200.10/24 brd 192.168.200.255 scope global noprefixroute eth0 valid_lft forever preferred_lft forever inet6 fe80::20c:29ff:fe3e:6fd4/64 scope link valid_lft forever preferred_lft forever 显示网络设备运行状态 [root@localhost ~]# ip link list 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000 link/ether 00:0c:29:3e:6f:d4 brd ff:ff:ff:ff:ff:ff 显示更加详细的设备信息 [root@localhost ~]# ip -s link list 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 RX: bytes packets errors dropped overrun mcast 5916 68 0 0 0 0 TX: bytes packets errors dropped carrier collsns 5916 68 0 0 0 0 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000 link/ether 00:0c:29:3e:6f:d4 brd ff:ff:ff:ff:ff:ff RX: bytes packets errors dropped overrun mcast 589343 7464 0 0 0 0 TX: bytes packets errors dropped carrier collsns 1432889 10926 0 0 0 0 [root@localhost ~]# 禁用或启用网络接口 [root@localhost ~]# ip link set lo down ; ip link set lo up 添加IP地址 [root@localhost ~]# ip addr add 192.168.200.20/24 dev eth0 [root@localhost ~]# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 00:0c:29:3e:6f:d4 brd ff:ff:ff:ff:ff:ff inet 192.168.200.10/24 brd 192.168.200.255 scope global noprefixroute eth0 valid_lft forever preferred_lft forever inet 192.168.200.20/24 scope global secondary eth0 valid_lft forever preferred_lft forever inet6 fe80::20c:29ff:fe3e:6fd4/64 scope link valid_lft forever preferred_lft forever [root@localhost ~]# 删除ip地址 [root@localhost ~]# ip addr del 192.168.200.20/24 dev eth0 [root@localhost ~]# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 00:0c:29:3e:6f:d4 brd ff:ff:ff:ff:ff:ff inet 192.168.200.10/24 brd 192.168.200.255 scope global noprefixroute eth0 valid_lft forever preferred_lft forever inet6 fe80::20c:29ff:fe3e:6fd4/64 scope link valid_lft forever preferred_lft forever 显示核心路由表 [root@localhost ~]# ip route list default via 192.168.200.2 dev eth0 proto static metric 100 192.168.200.0/24 dev eth0 proto kernel scope link src 192.168.200.10 metric 100 [root@localhost ~]#
命令功能:查看网络状态
常用参数:
命令实例:
[root@localhost ~]# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:22 *:*
LISTEN 0 100 127.0.0.1:25 *:*
LISTEN 0 128 :::22 :::*
LISTEN 0 100 ::1:25 :::*
[root@localhost ~]# ss -antlp
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:22 *:* users:(("sshd",pid=1142,fd=3))
LISTEN 0 100 127.0.0.1:25 *:* users:(("master",pid=1430,fd=13))
LISTEN 0 128 :::22 :::* users:(("sshd",pid=1142,fd=4))
LISTEN 0 100 ::1:25 :::* users:(("master",pid=1430,fd=14))
[root@localhost ~]#
常见端口:
配置文件路径 /etc/sysconfig/network-scripts/ifcfg-eth0
[root@localhost ~]#vi /etc/sysconfig/network-scripts/ifcfg-eth0
TYPE=Ethernet
BOOTPROTO=static
NAME=eth0
DEVICE=eth0
ONBOOT=yes
IPADDR=192.168.200.10
GATEWAY=192.168.200.2
PREFIX=24
DNS1=114.114.114.114
配置信息:
命名方式:
MBR分区
最多只能有四个主分区
最大支持2TB磁盘
GPT分区
[root@localhost ~]# fdisk /dev/nvme0n2 欢迎使用 fdisk (util-linux 2.23.2)。 更改将停留在内存中,直到您决定将更改写入磁盘。 使用写入命令前请三思。 Device does not contain a recognized partition table 使用磁盘标识符 0xf3363699 创建新的 DOS 磁盘标签。 //创建硬盘 命令(输入 m 获取帮助):n Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): Using default response p 分区号 (1-4,默认 1): 起始 扇区 (2048-41943039,默认为 2048): 将使用默认值 2048 Last 扇区, +扇区 or +size{K,M,G} (2048-41943039,默认为 41943039):+5G 分区 1 已设置为 Linux 类型,大小设为 5 GiB //列出硬盘 命令(输入 m 获取帮助):p 磁盘 /dev/nvme0n2:21.5 GB, 21474836480 字节,41943040 个扇区 Units = 扇区 of 1 * 512 = 512 bytes 扇区大小(逻辑/物理):512 字节 / 512 字节 I/O 大小(最小/最佳):512 字节 / 512 字节 磁盘标签类型:dos 磁盘标识符:0xf3363699 设备 Boot Start End Blocks Id System /dev/nvme0n2p1 2048 10487807 5242880 83 Linux //保存退出 命令(输入 m 获取帮助):w The partition table has been altered! Calling ioctl() to re-read partition table. 正在同步磁盘。 [root@localhost ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sr0 11:0 1 4.2G 0 rom nvme0n1 259:0 0 100G 0 disk ├─nvme0n1p1 259:1 0 1G 0 part /boot └─nvme0n1p2 259:2 0 99G 0 part ├─centos-root 253:0 0 50G 0 lvm / ├─centos-swap 253:1 0 3.9G 0 lvm [SWAP] └─centos-home 253:2 0 45.1G 0 lvm /home nvme0n2 259:3 0 20G 0 disk ├─nvme0n2p1 259:4 0 5G 0 part └─nvme0n2p2 259:5 0 1K 0 part [root@localhost ~]# partprobe /dev/nvme0n2
目的:是为了创建文件系统 mkfs(make filesystem)
类型:
实例:
[root@localhost ~]# mkfs.ext4 /dev/nvme0n2p1 mke2fs 1.42.9 (28-Dec-2013) 文件系统标签= OS type: Linux 块大小=4096 (log=2) 分块大小=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 327680 inodes, 1310720 blocks 65536 blocks (5.00%) reserved for the super user 第一个数据块=0 Maximum filesystem blocks=1342177280 40 block groups 32768 blocks per group, 32768 fragments per group 8192 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736 Allocating group tables: 完成 正在写入inode表: 完成 Creating journal (32768 blocks): 完成 Writing superblocks and filesystem accounting information: 完成 [root@localhost ~]#
临时挂载:
[root@localhost ~]# mkdir /zzz
[root@localhost ~]# mount -t ext4 /dev/nvme0n2p1 /zzz/
[root@localhost ~]# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/mapper/centos-root 50G 1.2G 49G 3% /
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 1.9G 12M 1.9G 1% /run
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/mapper/centos-home 46G 33M 46G 1% /home
/dev/nvme0n1p1 1014M 142M 873M 14% /boot
tmpfs 378M 0 378M 0% /run/user/0
/dev/nvme0n2p1 4.8G 20M 4.6G 1% /zzz
[root@localhost ~]#
永久挂载:
[root@localhost ~]# blkid /dev/nvme0n2p1 /dev/nvme0n2p1: UUID="68b056b3-c11a-48c5-9abe-d98c87d8b9fd" TYPE="ext4" [root@localhost ~]# vi /etc/fstab UUID="68b056b3-c11a-48c5-9abe-d98c87d8b9fd" /zzz ext4 defaults 0 0 [root@localhost ~]# mount -a [root@localhost ~]# df -h 文件系统 容量 已用 可用 已用% 挂载点 /dev/mapper/centos-root 50G 1.2G 49G 3% / devtmpfs 1.9G 0 1.9G 0% /dev tmpfs 1.9G 0 1.9G 0% /dev/shm tmpfs 1.9G 12M 1.9G 1% /run tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup /dev/mapper/centos-home 46G 33M 46G 1% /home /dev/nvme0n1p1 1014M 142M 873M 14% /boot tmpfs 378M 0 378M 0% /run/user/0 /dev/nvme0n2p1 4.8G 20M 4.6G 1% /zzz [root@localhost ~]#
时间配置
实例:
[root@localhost ~]# crontab -e
no crontab for root - using an empty one
crontab: installing new crontab
20 11 * * * /usr/bin/echo "woshineidie"
每天的11点20 执行命令
[root@localhost ~]# crontab -l
20 11 * * * /usr/bin/echo "woshineidie"
[root@localhost ~]#
1、syslog和rsyslog服务均有两个进程
2、日志服务配置文件
3、配置文件格式定义
auth | 认证相关的 |
---|---|
authpriv | 权限、授权相关的 |
cron | 任务计划相关的 |
daemon | 守护进程相关的 |
kern | 内核相关的 |
lpr | 打印机关的 |
邮件相关的 | |
mark | 标记相关的 |
news | 新闻相关的 |
security | 安全相关的,与auth类似 |
syslog | syslog自己的 |
user | 用户相关的 |
uucp | unix to unix cp相关的 |
local0到local7 | 用户自定义使用 |
***** | *表示所有的facility |
debug | 程序或系统的调试信息 |
---|---|
info | 一般信息 |
notice | 不影响正常功能,需要注意的消息 |
warning/warn | 可能影响系统功能,需要提醒用户的重要事件 |
err/error | 错误信息 |
crit | 紧急,比较严重的 |
alert | 必须马上处理的 |
emerg/panic | 会导致系统不可用的 |
***** | *表示所有的日志级别 |
none | 跟*相反,表示啥也没有 |
系统上的绝对路径 | 普通文件,如:/var/log/xxx |
---|---|
| COMMAND | 管道,通过管道送给其他的命令处理 |
终端 | 终端,如:/dev/console |
@HOST | 远程主机(远程主机必须要监听在tcp或udp协议514端口上提供服务),如:@10.0.0.1 |
用户 | 系统用户,如:root |
***** | 登录到系统上的所有用户 |
4、格式定义的例子
5、文件记录(/var/log/message)的日志的格式:
6、lastlog命令:显示当前系统每一个用户最近一次的登入时间
//配置rsyslog服务器 //编辑配置文件(/etc/rsyslog.conf),将下列内容前面的注释去掉,然后重启rsyslog服务即可: #$ModLoad imudp #$UDPServerRun 514 #$ModLoad imtcp #$InputTCPServerRun 514 [root@localhost ~]# vi /etc/rsyslog.conf $ModLoad imudp $UDPServerRun 514 $ModLoad imtcp $InputTCPServerRun 514 //配置使用基于mysql存储日志信息的rsyslog服务器:假定此处的mysql和rsyslog是两台不同的主机 注意:请关闭防火墙和SELINUX 1.确保mysql服务正常 2.在rsyslog服务器上安装rsyslog-mysql模块(yum -y install rsyslog-mysql) [root@rsyslog ~]# yum -y install rsyslog-mysql 已加载插件:fastestmirror Determining fastest mirrors * base: mirrors.tuna.tsinghua.edu.cn * extras: mirrors.aliyun.com * updates: mirrors.tuna.tsinghua.edu.cn base | 3.6 kB 00:00 extras | 2.9 kB 00:00 updates | 2.9 kB 00:00 (1/4): extras/7/x86_64/primary_db | 242 kB 00:00 (2/4): base/7/x86_64/group_gz | 153 kB 00:00 (3/4): base/7/x86_64/primary_db | 6.1 MB 00:01 (4/4): updates/7/x86_64/primary_db | 8.8 MB 00:02 正在解决依赖关系 --> 正在检查事务 ---> 软件包 rsyslog-mysql.x86_64.0.8.24.0-57.el7_9.1 将被 安装 .... 3.在mysql服务器上授权一个用户能够对Syslog数据库有写权限 mysql> GRANT ALL ON syslog.* TO 'syslog'@'192.168.%.%' IDENTIFIED BY 'syslogpassword'; Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> 4.配置mysql服务器,在主配置文件(/etc/my.cnf)中添加下面两行内容,并重启mysql服务 [root@mysql ~]# vi /etc/my.cnf skip_name_resolve = on innodb_file_per_table = on 5.在rsyslog服务器上执行sql语句 [root@rsyslog ~]# mysql -usyslog -h192.168.200.141 -psyslogpassword < /usr/share/doc/rsyslog-8.24.0/mysql-createDB.sql 6.配置rsyslog服务器能使用mysql存储日志。编辑/etc/rsyslog.conf文件并重启rsyslog服务 在### MODULES ###段下面添加如下内容: $ModLoad ommysql 在### RULES ###段下面添加如下内容: *.info;mail.none;authpriv.none;cron.none :ommysql:192.168.200.141,Syslog,syslog,syslogpassword ommysql:表示使用ommysql模块存储日志至mysql Syslog:表示mysql中的Syslog数据库 syslog:表示连接mysql的用户 syslogpassword:表示连接mysql的密码 7.配置webserver,支持php [root@mysql ~]# yum install httpd php php-mysql php-gd 已加载插件:fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.ustc.edu.cn * extras: mirrors.nju.edu.cn * updates: mirrors.nju.edu.cn base | 3.6 kB 00:00 extras | 2.9 kB 00:00 mysql-connectors-community | 2.6 kB 00:00 mysql-tools-community | 2.6 kB 00:00 mysql57-community | 2.6 kB 00:00 updates | 2.9 kB 00:00 正在解决依赖关系 --> 正在检查事务 ---> 软件包 httpd.x86_64.0.2.4.6-97.el7.centos 将被 安装 --> 正在处理依赖关系 httpd-tools = 2.4.6-97.el7.centos,它被软件包 httpd-2.4.6-97.el7.centos.x86_64 需要 ...... [root@mysql ~]# systemctl start httpd 8.配置前端展示界面(loganalyzer软件) [root@mysql ~]# tar xf loganalyzer-3.6.5.tar.gz [root@mysql ~]# mv loganalyzer-3.6.5/src /var/www/html/loganalyzer [root@mysql ~]# cp -a loganalyzer-3.6.5/contrib/*.sh /var/www/html/loganalyzer/ [root@mysql ~]# cd /var/www/html/loganalyzer/ [root@mysql loganalyzer]#chmod +x *.sh [root@mysql loganalyzer]#./configure.sh [root@mysql loganalyzer]#./secure.sh [root@mysql loganalyzer]#chmod 666 config.php #如果没有此文件则手动touch一个即可 在浏览器上输入:http://IP/loganalyzer/install.php
编译安装三步:
//在官网拉取三个包 [root@localhost ~]# wget https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-util-1.6.1.tar.gz [root@localhost ~]# wget https://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.4.48.tar.gz [root@localhost ~]# wget https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-1.7.0.tar.gz //解压 [root@localhost ~]# tar xf apr-1.7.0.tar.gz [root@localhost ~]# tar xf apr-util-1.6.1.tar.gz [root@localhost ~]# tar xf httpd-2.4.48.tar.gz //进入到apr-1.7.0 删除或注释 $RM "$cfgfile" [root@localhost apr-1.7.0]# vi configure //开始编译安装 [root@localhost apr-1.7.0]# ./configure --prefix=/usr/local/apr 可能会报错需要安装 gcc //安装gcc [root@localhost apr-1.7.0]# yum -y install gcc gcc-c++ //再次编译 [root@localhost apr-1.7.0]# ./configure --prefix=/usr/local/apr configure: creating ./config.status config.status: creating Makefile config.status: creating include/apr.h config.status: creating build/apr_rules.mk config.status: creating build/pkg/pkginfo config.status: creating apr-1-config config.status: creating apr.pc config.status: creating test/Makefile config.status: creating test/internal/Makefile config.status: creating include/arch/unix/apr_private.h config.status: executing libtool commands config.status: executing default commands //开始make 编译 [root@localhost apr-1.7.0]#make && make install [root@localhost apr-1.7.0]# make && make install make[1]: 进入目录“/root/apr-1.7.0” /bin/sh /root/apr-1.7.0/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -I./include -I/root/apr-1.7.0/include/arch/unix -I./include/arch/unix -I/root/apr-1.7.0/include/arch/unix -I/root/apr-1.7.0/include -I/root/apr-1.7.0/include/private -I/root/apr-1.7.0/include/private -o strings/apr_strings.lo -c strings/apr_strings.c && touch strings/apr_strings.lo /bin/sh /root/apr-1.7.0/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -I./include -I/root/apr-1.7.0/include/arch/unix -I./include/arch/unix -I/root/apr-1.7.0/include/arch/unix -I/root/apr-1.7.0/include -I/root/apr-1.7.0/include/private -I/root/apr-1.7.0/include/private -o stri ...... //进入到apr-util 开始编译安装 [root@localhost ~]# cd apr-util-1.6.1 [root@localhost apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking target system type... x86_64-pc-linux-gnu checking for a BSD-compatible install... /usr/bin/install -c checking for working mkdir -p... yes APR-util Version: 1.6.1 checking for chosen layout... apr-util checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no .... //make编译安装 [root@localhost apr-util-1.6.1]# make && make install make[1]: 进入目录“/root/apr-util-1.6.1” /bin/sh /usr/local/apr/build-1/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -I/root/apr-util-1.6.1/include -I/root/apr-util-1.6.1/include/private -I/usr/local/apr/include/apr-1 -o buckets/apr_brigade.lo -c buckets/apr_brigade.c && touch buckets/apr_brigade.lo /bin/sh /usr/local/apr/build-1/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -I/root/apr-util-1.6.1/include -I/root/apr-util-1.6.1/include/private -I/usr/local/apr/include/apr-1 -o buckets/apr_buckets.lo -c buckets/apr_buckets.c && touch buckets/apr_buckets.lo /bin/sh /usr/local/apr/build-1/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -I/root/apr-util-1.6.1/include -I/root/apr-util-1.6.1/include/private -I/usr/local/apr/include/apr-1 -o buckets/apr_buckets_alloc.lo -c buckets/apr_buckets_alloc.c && touch buckets/apr_buckets_alloc.lo /bin/sh /usr/local/apr/build-1/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -I/root/apr-util-1.6.1/include -I/root/apr-util-1.6.1/include/private -I/usr/local/apr/include/apr-1 -o buckets/apr_buckets_eos.l ..... //进入到httpd里开始编译安装 [root@localhost apr-util-1.6.1]# cd /root/httpd-2.4.48 [root@localhost httpd-2.4.48]# ./configure --prefix=/usr/local/httpd--with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util checking for chosen layout... Apache checking for working mkdir -p... yes checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking target system type... x86_64-pc-linux-gnu configure: configure: Configuring Apache Portable Runtime library... configure: checking for APR... yes setting CC to "gcc" setting CPP to "gcc -E" setting CFLAGS to " -g -O2 -pthread" setting CPPFLAGS to " -DLINUX -D_REENTRANT -D_GNU_SOURCE" setting LDFLAGS to " " configure: configure: Configuring Apache Portable Runtime Utility library... configure: checking for APR-util... yes checking for gcc... gcc ..... //开始make [root@localhost httpd-2.4.48]# make && make install Making all in srclib make[1]: 进入目录“/root/httpd-2.4.48/srclib” make[1]: 离开目录“/root/httpd-2.4.48/srclib” Making all in os make[1]: 进入目录“/root/httpd-2.4.48/os” Making all in unix make[2]: 进入目录“/root/httpd-2.4.48/os/unix” make[3]: 进入目录“/root/httpd-2.4.48/os/unix” /usr/local/apr/build-1/libtool --silent --mode=compile gcc -std=gnu99 -g -O2 -pthread -DLINUX -D_REENTRANT -D_GNU_SOURCE -I. -I/root/httpd-2.4.48/os/unix -I/root/httpd-2.4.48/include -I/usr/local/apr/include/apr-1 -I/usr/local/apr-util/include/apr-1 -I/root/httpd-2.4.48/modules/aaa -I/root/httpd-2.4.48/modules/cache -I/root/httpd-2.4.48/modules/core -I/root/httpd-2.4.48/modules/database -I/root/httpd-2.4.48/modules/filters -I/root/httpd-2.4.48/modules/ldap -I/root/httpd-2.4.48/modules/loggers -I/root/httpd-2.4.48/modules/lua -I/root/httpd-2.4.48/modules/proxy -I/root/httpd-2.4.48/modules/http2 -I/root/httpd-2.4.48/modules/session -I/root/httpd-2.4.48/modules/ssl -I/root/httpd-2.4.48/modules/test -I/root/httpd-2.4.48/server -I/root/httpd-2.4.48/modules/md -I/root/httpd-2.4.48/modules/arch/unix -I/root/httpd-2.4.48/modules/dav/main -I/root/httpd-2.4.48/modules/generators -I/root/httpd-2.4.48/modules/mappers -prefer-non-pic -static -c unixd.c && touch unixd.lo /usr/local/apr/build-1/libtool --silent --mode=link gcc -std=gnu99 -g -O2 -pthread -o libos.la -static unixd.lo ..... //安装完毕启动 [root@localhost local]# cd httpd/ [root@localhost httpd]# ls bin cgi-bin error icons logs manual build conf htdocs include man modules [root@localhost httpd]# /usr/local/httpd/bin/apachectl start AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message [root@localhost httpd]# ss -antl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 *:22 *:* LISTEN 0 100 127.0.0.1:25 *:* LISTEN 0 128 :::80 :::* LISTEN 0 128 :::22 :::* LISTEN 0 100 ::1:25 :::* [root@localhost httpd]# //关闭防火墙 [root@localhost httpd]# systemctl stop firewalld [root@localhost httpd]# systemctl disable firewalld Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service. Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service. [root@localhost httpd]# setenforce 0 [root@localhost httpd]# //访问
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。