linux Text Processing sed, Package Management, Disk Storage and File System

1. Base name and document name

[root@centos7 scripts38]#echo /etc/sysconfig/network-scripts/ |sed -r 's@(^/.*/)([^/]+)/?$@\1@'
[root@centos7 scripts38]#echo /etc/sysconfig/network-scripts/ |sed -r 's@(^/.*/)([^/]+)/?$@\2@'

2. Modify the network to eth0

[root@centos7 scripts38]#sed -ri '/^[[:space:]]+linux16/s@(.*)@& net.infnames=0@' /boot/grub2/grub.cfg 
[root@centos7 data]#sed -ri '/GRUB_CMDLINE_LINUX=/s@"$@ net.ifnames=0"@' /etc/default/grub

3. You may need to download the previous package before you can open the magic folder and automatically mount the CD.

[root@centos7 Packages]#[root@centos7 ~]#yum install autofs
[root@centos7 data]#systemctl start autofs
[root@centos7 data]#systemctl enable autofs
Created symlink from /etc/systemd/system/ to /usr/lib/systemd/system/autofs.service.
[root@centos7 data]#cd /misc
[root@centos7 misc]#cd cd/

4. Import RPM banknote checker

[root@centos7 scripts38]#ls /misc/cd/
CentOS_BuildTag  images    repodata
EFI              isolinux  RPM-GPG-KEY-CentOS-7
EULA             LiveOS    RPM-GPG-KEY-CentOS-Testing-7
GPL              Packages  TRANS.TBL
[root@centos7 scripts38]#rpm --import /misc/cd/RPM-GPG-KEY-CentOS-7

4. Local and AriYUM source configuration. Clear the cache yum clean all

name=cdrom base

name=aliyun epel
enabled=0     #Turn on epel and replace it with 1

Configure the Aliyun repo source and pay attention to the working directory.

[root@centos7 data]#wget
[root@centos7 /]#mv Centos-7.repo /etc/yum.repos.d/

5. Building YUM Network Source

[root@centos7 data]#yum install httpd
[root@centos7 data]#systemctl start httpd
[root@centos7 data]#cd /var/www/html
[root@centos7 html]#mkdir -pv  centos/{6,7}/os/x86_64/
[root@centos7 html]#mount /dev/sr0 centos/7/os/x86_64/
mount: /dev/sr0 is write-protected, mounting read-only
[root@centos7 html]#mount /dev/sr1 centos/6/os/x86_64/
mount: /dev/sr1 is write-protected, mounting read-only

6. Delete all blank characters in the centos7 system/etc/grub2.cfg file beginning with blank lines

[root@centos7 ~]#sed -r 's/^[[:space:]]([[:space:]]+.*)/\1/' /etc/grub2.cfg

7. Delete all and blank characters in the / etc/fstab file that begin with followed by at least one blank character at the beginning of the line

[root@centos7 yum.repos.d]#sed -r 's/^#[[:space:]]+//' /etc/fstab

8. Add # at the beginning of each line in centos6 system/root/install.log

[root@centos6 ~]#sed -r 's/(.*)/#\1/' /root/install.log

9. Processing the / etc/fstab path, using sed command to fetch its directory and base name

[root@centos7 ~]#echo /etc/fstab | sed -r 's@(^/.*/)([^/]+)/?$@\1@'
[root@centos7 ~]#echo /etc/fstab | sed -r 's@(^/.*/)([^/]+)/?$@\2@'

10. Use sed to get the IPv4 address of the local computer in ifconfig command

[root@centos7 ~]#ifconfig eth0 | sed -rn '2s/^[^0-9]+([0-9.]+).*/\1/p'

11. Statistics of the number of repetitions of the penultimate field separated by. for all rpm files in the Package directory of the centos installation CD-ROM

[root@centos7 Packages]#ls /misc/cd/Packages/ |sed -rn 's@.*\.(.*)\..*@\1@p'|sort|uniq -c|sort -nr
   4639 x86_64
   3122 noarch
   2258 i686

SNART didn't know that was how it came about...

[root@centos7 Packages]#ls /misc/cd/Packages/ |rev|cut -d '.' -f2 |sort |uniq -c |sort -nr
   4639 46_68x
   3122 hcraon
   2258 686i
      1 SNART

12. Statistics the number of occurrences of each word in the / etc/init.d/functions file and sort them (using grep and sed methods respectively)

It's supposed to be okay.

[root@centos7 Packages]#cat /etc/init.d/functions |egrep -o "\<[[:alpha:]]+\>" |sort |uniq -c|sort -nr
     60 if
     54 return
     52 then
     51 fi
     49 echo
     46 pid
     38 n

It doesn't seem to be true. sed still doesn't have the function of taking words.

[root@centos7 Packages]#cat /etc/init.d/functions |sed -r 's@[^[:alpha:]]+@\n@g'|sort|uniq -c|sort -nr|head
     73 pid
     60 if
     58 file
     57 echo
     54 return
     52 then
     51 fi
     39 n
     38 base

This should be wrong...

[root@centos7 Packages]#cat /etc/init.d/functions |sed -r 's@[[:space:]]+@\n@g'|sort|uniq -c|sort -nr|head
    103 [
     66 #
     64 ]
     59 &&
     58 if
     54 return
     52 then
     51 fi
     43 echo

13. Merge the n and n+1 lines of the text file into one line, and n is an odd line

[root@centos7 Packages]#seq 10 |xargs -n2
1 2
3 4
5 6
7 8
9 10

The advanced usage of sed is too perverted. Hair tends to be bald and can't be played.

[root@centos7 Packages]#seq 10|sed 'N;s/\n/ /'
1 2
3 4
5 6
7 8
9 10

14. Match yourself with some yum warehouses

[root@centos7 data]#mkdir dnf
[root@centos7 data]#cd dnf/
[root@centos7 dnf]#rz -E
rz waiting to receive.
[root@centos7 dnf]#ll
total 808
-rw-r--r-- 1 root root 213696 Jun  4  2018 dnf-0.6.4-2.sdl7.noarch.rpm
-rw-r--r-- 1 root root  62404 Jun  4  2018 dnf-conf-0.6.4-2.sdl7.noarch.rpm
-rw-r--r-- 1 root root  75472 Jun  4  2018 libcomps-0.1.8-3.el7.x86_64.rpm
-rw-r--r-- 1 root root  46792 Jun  4  2018 python2-libcomps-0.1.8-3.el7.x86_64.rpm
-rw-r--r-- 1 root root 416988 Jun  4  2018 python-dnf-0.6.4-2.sdl7.noarch.rpm
//Automatically generate repodata
[root@centos7 dnf]#createrepo .
Spawning worker 0 with 3 pkgs
Spawning worker 1 with 2 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
//Configure repo yourself
[root@centos7 yum.repos.d]#cat dnf.repo 
//Check for success
[root@centos7 yum.repos.d]#yum repolist 

The script is written later.

tar -xvf httpd-2.4.25.tar.bz2
cd httpd-2.4.25/
//Specify the path, the location of the configuration file, open some services, report errors, missing APR
[root@centos7 httpd-2.4.25]#./configure  --prefix=/apps/httpd24 --sysconfdir=/etc/httpd --enable-ssl --enable-so
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-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
configure: Configuring Apache Portable Runtime library...
checking for APR... no
configure: error: APR not found.  Please read the documentation.
//Usually devel development kits
[root@centos7 httpd-2.4.25]#yum search apr
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
========================================== N/S matched: apr ===========================================
apr-devel.i686 : APR library development kit
apr-devel.x86_64 : APR library development kit
//Download the APR package
[root@centos7 httpd-2.4.25]#yum install apr-devel
//What is missing to make up for what is missing?
[root@centos7 httpd-2.4.25]#yum install apr-util-devel
[root@centos7 httpd-2.4.25]#yum install pcre-devel
//Error, not this package [root@centos7 httpd-2.4.25]#yum install mod_ssl
[root@centos7 httpd-2.4.25]#yum install openssl-devel
//And there's a gcc in front of it.
//After success, make compilation is performed
//Then make install
[root@centos7 httpd-2.4.25]#make
[root@centos7 httpd-2.4.25]#make install
//Upon completion
[root@centos7 httpd24]#cd /apps/httpd24/
//Write it in environmental variables
[root@centos7 httpd24]#vim /etc/profile.d/
//Reread and refresh environment variables
[root@centos7 httpd24]#. /etc/profile.d/
//Open Services
[root@centos7 httpd24]#apachectl restart
//Auto-startup files, to write in the path
[root@centos7 httpd24]#ll /etc/rc.d/rc.local
-rw-r--r--. 1 root root 473 Oct 31  2018 /etc/rc.d/rc.local
[root@centos7 httpd24]#vim /etc/rc.d/rc.local
//Write the following in
/apps/httpd24/bin/apachectl start 
//Then give the file permission to execute.
[root@centos7 httpd24]#chmod +x /etc/rc.d/rc.local
//Where the page is displayed, you can modify it yourself.
[root@centos7 httpd24]#cd htdocs/
[root@centos7 htdocs]#ll
total 4
-rw-r--r-- 1 root root 45 Jun 12  2007 index.html

15. Compile a little thing

[root@centos7 data]#tar -xvf cmatrix-1.2a.tar.gz 
[root@centos7 cmatrix]#yum install ncurses-devel
[root@centos7 cmatrix]#./configure --prefix=/apps/cmatrix
[root@centos7 cmatrix]#make
[root@centos7 cmatrix]#make install

16. Backup and restore of MBR partition table

Look at the top 512 bytes of the MBR partition table
[root@centos7 data]#hexdump -C /dev/sda -n 512
 Copy out 64 bytes of the partition table. Skp is 446 bytes that skip the original file.
[root@centos7 data]#dd if=/dev/sda of=/data/mar_db bs=1 count=64 skip=446
64+0 records in
64+0 records out
64 bytes (64 B) copied, 0.000585693 s, 109 kB/s
 Copy data to other servers
[root@centos7 data]#scp mar_db root@
 To destroy the original partition table, seek is 446 bytes that skip the target. The server could not start.
[root@centos7 data]#dd if=/dev/zero of=/dev/sda bs=1 count=64 seek=446
 Restart and enter rescue mode. Temporarily assign an IP address
[root@centos7 ~]#ifconfig ens33
 Copy back the backup
[root@centos7 ~]#scp root@ .
[root@centos7 data]#dd if=mar_db of=/dev/sda bs=1 count=64 skip=446
 Reset computer

MBR partition
According to cylindrical surface

Up to four partitions, three main partitions and one extended partition. There can be multiple logical partitions in the extended partition.

Manage up to 2T of space

GPT partition

By sector

128 partitions

Manage up to 8Z space

128-bit UUID

Partition table has backup function

17.parted command

parted operations are in effect in real time. Use them carefully.
Usage: parted [option]... [device [command [parameter]...]
parted /dev/sdb mklabel gpt|msdos
parted /dev/sdb print
 Parted/dev/sdb mkpart primary 1 200 (default M)
parted /dev/sdb rm 1
 Partied/dev/sdb-l lists partition information

18. Analog file system failure

[root@centos7 data]#dd if=/dev/zero of=/dev/sda5 bs=1M count=1
 It's been destroyed and the superblock can't be opened.
[root@centos7 data]#tune2fs -l /dev/sda5
tune2fs 1.42.9 (28-Dec-2013)
tune2fs: Bad magic number in super-block while trying to open /dev/sda5
Couldn't find valid filesystem superblock.
Unmount first. Must be repaired without mounting
[root@centos7 ~]#umount /data
 File system failure. Unable to mount
[root@centos7 ~]#mount /dev/sda5 /data/
mount: mount /dev/sda5 on /data failed: Structure needs cleaning
 Repair method of xfs system
[root@centos7 data]#xfs_repair /dev/sda5
 Repair methods of CentOS 6 ext series
fsck /dev/sda5 -y
 Repair completed can be mounted
[root@centos7 ~]#mount /dev/sda5 /data/
[root@centos7 ~]#cd /data/
Data loss
[root@centos7 data]#ll
total 12
drwxr-xr-x 246 root root 8192 Aug  8 16:34 lost+found

19. Adding swap partitions, the process is not written. Files can not be UUID, otherwise restart will lose, to write the file name.

[root@centos7 ~]#swapon -s
Filename                Type        Size    Used    Priority
/dev/sdb1                               partition   4194300 0   -1
/dev/sda3                               partition   2097148 0   -2
/swapfile                               file    2097148 0   -3

20. File mount files

Create a large file
[root@centos7 ~]#dd if=/dev/zero of=/bigfile bs=1M count=1024 
//Format EXT4
[root@centos7 ~]#mkfs.ext4 /bigfile
mke2fs 1.42.9 (28-Dec-2013)
/bigfile is not a block special device.
Proceed anyway? (y,n) y
Discarding device blocks: done                 
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
65536 inodes, 262144 blocks
13107 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=268435456
8 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
    32768, 98304, 163840, 229376

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
//View format information
[root@centos7 ~]#blkid /bigfile
/bigfile: UUID="9e1393ae-8e18-4dee-af73-4fafa373ff29" TYPE="ext4" 
//Write file to permanent mount

21. Migrate / home data to a new location in maintenance status. That's the single user mode. init 1

[root@centos7 data]#mkfs.xfs /dev/sdb2
[root@centos7 data]#mkdir /mnt/home
[root@centos7 data]#mount /dev/sdb2 /mnt/home/
[root@centos7 data]#cp -av /home/. /mnt/home/
[root@centos7 data]#vim /etc/fstab 
UUID=63b5335d-a455-45a8-8f3f-3ebf66fb240a   /home              xfs      defaults    0  0 
[root@centos7 data]#mount -a
//Keep the data for a period of time, no problem, cancel the mount, ready to delete the original data
[root@centos7 data]#umount /home/
//What you see now is the original / home data, which is overwritten and invisible when mounted.
[root@centos7 data]#ls /home
//Delete all the original data. Be careful not to delete folders.
[root@centos7 data]#rm -rf /home/*
//Once you reload, the data will be migrated to the new hard disk.
[root@centos7 data]#mount -a
[root@centos7 data]#df
/dev/sdb2        2086912   33052   2053860   2% /home

22. Create a 2G file system with block size of 2048 byte, reserve 1% free space, file system ext4, volume labeled TEST, require this partition to be automatically mounted to / test directory after booting, and default has the option of acl mount.

[root@centos7 data]#fdisk /dev/sdb
[root@centos7 data]#mke2fs -t ext4 -b 2048 -L 'TEST' -m 1 /dev/sdb5
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=TEST
OS type: Linux
Block size=2048 (log=1)
Fragment size=2048 (log=1)
Stride=0 blocks, Stripe width=0 blocks
131072 inodes, 1048576 blocks
10485 blocks (1.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=269484032
64 block groups
16384 blocks per group, 16384 fragments per group
2048 inodes per group
Superblock backups stored on blocks: 
    16384, 49152, 81920, 114688, 147456, 409600, 442368, 802816

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done 
[root@centos7 data]#vim /etc/fstab
UUID=e02a9d53-6f8a-4dca-a130-5296fe24975b  /mnt/sdb5              ext4     acl            0 0
[root@centos7 data]#mount -a

23. Write a script to accomplish the following functions: (1) List all disk devices recognized by the current system (2) If the number of disks is 1, then display the spatial information. Otherwise, the last space on the disk will show the information.

#Colour configuration

df |grep /dev/sd | tr -s ' '|cut -d ' ' -f1

echo -e "${COLOR}Disk equipment checked out $COLOREND"

NUM=`df |grep /dev/sd |wc -l`
[ "$NUM" -eq 1 ] && echo -e "Disk utilization: ${COLOR}`df |grep /dev/sd | tr -s ' '|cut -d ' ' -f5` $COLOREND"
[ "$NUM" -gt 1 ] && echo -e "Utilization of the last disk: ${COLOR}`df |grep /dev/sd | tr -s ' '|cut -d ' ' -f5|tail -n 1` $COLOREND" 
[root@centos7 data]#bash 
 Disk equipment checked out 
Utilization of the last disk: 1% 

24. Briefly describe the common linux software systems, what are their differences?

1. EXT3 
(1) Only 32TB filesystems and 2TB files can be supported at most, but only 2TB filesystems and 16GB files can be accommodated in practice.
(2) Ext3 currently supports only 32000 subdirectories
 (3) Ext3 file system uses 32-bit spatial record blocks and i-nodes
 (4) When data is written to the Ext3 file system, the Ext3 data block allocator can only allocate one 4KB block at a time.
2. EXT4 
EXT4 is a log file system under Linux system and a successor version of EXT3 file system.
(1) Ext4 has a file system capacity of 1 EB and a file system capacity of 16 TB. 
(2) Supporting an infinite number of subdirectories in theory
 (3) Ext4 file system uses 64-bit spatial record blocks and i-nodes
 (4) Ext 4's multi-block allocator supports multiple data blocks allocated by one call
3. XFS 
(1) Quickly restore the contents of disk files in a short period of time based on the logs recorded
 (2) Using optimization algorithm, log record has little effect on the whole file operation.
(3) It is a 64-bit file system that supports millions of T bytes of storage space.
(4) Storage data with performance close to bare device I/O

25. Simple scripts for personal configuration.

#Author:        zhangfeng
#QQ:            553645084
#Date:          2019-08-03
#Description:        The test script
#Copyright (C):     2019 All rights reserved

#Colour configuration

echo -e "${COLOR}Boot prompt configuration $COLOREND"
cat > /etc/issue << EOF
time is \t
tty is \l
hostname is \n 
Kernel \r on an \m
sleep 1

echo -e "${COLOR}Alias environment variable configuration $COLOREND"
cat > /etc/profile.d/ << EOF
alias cdnet="cd /etc/sysconfig/network-scripts"
alias editnet="vim /etc/sysconfig/network-scripts/ifcfg-ens33"
alias scandisk="echo '- - -' > /sys/class/scsi_host/host2/scan;echo '- - -' > /sys/class/scsi_host/host0/scan" 
export PATH=/app/bin:$PATH
export EDITOR=vim
export HISTCONTROL=ignoreboth

echo -e "${COLOR}Prompt Configuration $COLOREND"
echo 'PS1="\[\e[1;32m\][\u@\h \W]\\$\[\e[0m\]"' >> /etc/profile.d/
sleep 1 

echo -e "${COLOR}VIM To configure $COLOREND"
cat > ~/.vimrc << EOF
set ignorecase
set cursorline
set autoindent
autocmd BufNewFile *.sh exec ":call SetTitle()"
func SetTitle()
    if expand("%:e") == 'sh'
    call setline(1,"#!/bin/bash") 
    call setline(2,"#") 
    call setline(3,"#********************************************************************") 
    call setline(4,"#Author:        zhangfeng") 
    call setline(5,"#QQ:            553645084") 
    call setline(6,"#Date:          ".strftime("%Y-%m-%d"))
    call setline(7,"#FileName:       ".expand("%"))
    call setline(8,"#URL: ")
    call setline(9,"#Description:        The test script") 
    call setline(10,"#Copyright (C):    ".strftime("%Y")." All rights reserved")
    call setline(11,"#********************************************************************") 
    call setline(12,"") 
autocmd BufNewFile * normal G
sleep 1 

#Close selinux
echo -e "${COLOR}selinux Closed $COLOREND"
sed -i  's/SELINUX=enforcing/SELINUX=disabled/ ' /etc/selinux/config
sleep 1 

#Change ens33 to eth0
echo -e "${COLOR}Change the name of the network card to eth0 $COLOREND"
sed -ri '/GRUB_CMDLINE_LINUX=/s@"$@ net.ifnames=0"@' /etc/default/grub
sed -ri '/^[[:space:]]+linux16/s#(.*)#\1 net.ifnames=0#' /boot/grub2/grub.cfg
sleep 1 

#Version 7 Closes Firewall
echo -e "${COLOR}Close version 7 firewall $COLOREND"
systemctl disable firewalld.service
sleep 1 

#Version 6 Closes Firewall
echo -e "${COLOR}Close version 6 firewall $COLOREND"
chkconfig iptables off
sleep 1 

#Configure Aliyun YUM Source for Version 7                                                            
echo -e "${COLOR}7 Version Aliyun repo Source Configuration $COLOREND"
mkdir /etc/yum.repos.d/bak
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak/
#mv Centos-7.repo /etc/yum.repos.d/
#touch /etc/yum.repos.d/mirrorlist
#cat > /etc/yum.repos.d/mirrorlist <<EOF
touch /etc/yum.repos.d/epel.repo
cat > /etc/yum.repos.d/epel.repo <<EOF
sleep 1 

echo -e "${COLOR}Aliyun General Source Configuration $COLOREND"
touch /etc/yum.repos.d/base.repo
cat > /etc/yum.repos.d/base.repo <<EOF
sleep 1 

yum clean all

echo -e "${COLOR}Automatic download software $COLOREND"
yum install tree -y
yum install ftp -y
yum install lftp -y
yum install telnet -y
yum install autofs gcc gcc-c++ glibc glibc-devel pcre pcre-devel
openssl openssl-devel systemd-devel zlib-devel vim lrzsz tree screen lsof
tcpdump wget ntpdate net-tools iotop bc zip unzip nfs-utils -y

sleep 1 

echo -e "${COLOR}Server Basic Information $COLOREND"
echo -e  "CPU type is ${COLOR}`cat /proc/cpuinfo|grep -im1 'model name'|cut -d: -f2|tr -s ' '`$COLOREND"
echo -e "Mem is ${COLOR}`cat /proc/meminfo |head -1 | tr -s " " |cut -d: -f2`$COLOREND"
echo -e "Disk size is ${COLOR}`cat /proc/partitions |grep "sda$" |tr -s " " |cut -d" " -f4` kB$COLOREND"

echo -e "OS version is ${COLOR}`cat /etc/redhat-release`$COLOREND"
echo -e "Kernel version is ${COLOR}`uname -r`$COLOREND"

26.httpd2.4.25 Automatic Installation Script

#Author:        zhangfeng
#QQ:            553645084
#Date:          2019-08-06
#Description:        The test script
#Copyright (C):     2019 All rights reserved

#Colour configuration
echo -e "${COLOR}httpd2.4.25 Installation scripts are suitable centos7.6,7.5 Version, other unknown $COLOREND"

#The premise must be a / data directory.
#Two Methods of Obtaining Compressed Packets
#scp root@ /data/

#Download Configuration Environment
yum install apr-devel -y 
yum install pcre-devel -y 
yum install openssl-devel -y
yum install gcc -y 
yum install apr-util-devel -y 

#Compile and install
tar -xvf /data/httpd-2.4.25.tar.bz2 -C /data/
cd /data/httpd-2.4.25/
./configure  --prefix=/apps/httpd24 --sysconfdir=/etc/httpd --enable-ssl --enable-so
make install
echo $? &&  echo -e "${COLOR}httpd2.4.25 installation is complete $COLOREND"
echo -e '\a'

#Configuring environment variables
echo 'PATH=/apps/httpd24/bin:$PATH' >> /etc/profile.d/
. /etc/profile.d/

#Open Services
cd /apps/httpd24/
apachectl restart

#Boot-up Automatic Start Configuration
echo '/apps/httpd24/bin/apachectl start' >> /etc/rc.d/rc.local
chmod +x /etc/rc.d/rc.local
echo -e "${COLOR}httpd2.4.25 Installation completed and started. Start-up automatic start-up $COLOREND"

27. Unload httpd2.4.25 script

#Author:        zhangfeng
#QQ:            553645084
#Date:          2019-08-07
#Description:        The test script
#Copyright (C):     2019 All rights reserved

#Colour configuration
echo -e "${COLOR}httpd2.4.25 Uninstall scripts are suitable centos7.6,7.5 Version, only with $COLOREND"

#Delete installation directory, configuration file directory, decompression package, compressed package.
rm -rf /etc/httpd
rm -rf /apps/httpd24
rm -rf /data/httpd-2.4.25.tar.bz2
rm -rf /data/httpd-2.4.25
echo -e "${COLOR}Installation directory, configuration file directory, decompression package, compressed package deletion completed $COLOREND"

sed -i '/PATH=\/apps\/httpd24\/bin:$PATH/d' /etc/profile.d/
sed -i '/\/apps\/httpd24\/bin\/apachectl start/d' /etc/rc.d/rc.local

echo -e "${COLOR}httpd2.4.25 Unloading completed $COLOREND"

Tags: Linux yum CentOS RPM EPEL

Posted on Sat, 10 Aug 2019 01:13:39 -0700 by s_bastian