Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Bài 4: Cài Đặt Chương Trình Apache 2.4.41 Từ Mã Nguồn
- Mục Lục
- 1. Các bước chính quá trình cài đặt từ mã nguồn
- 2. Biên dịch Cài đặt Apache 2.4.41
- 3. Thiết lập scripts để khởi động dịch vụ cài đặt
- 1. Các bước chính quá trình cài đặt từ mã nguồn
- - Download source chương trình
- - Giải nén và chuyển vào trong folder
- - Tạo file configure
- - Make
- - Make install
- 2. Biên dịch Cài đặt Apache 2.4.41
- - Link tham khảo quá trình cài đặt
- http://httpd.apache.org/docs/current/install.html
- - Cài đặt các thư viện cần thiết
- [root@desktop ~]# dnf install gcc
- [root@desktop ~]# dnf install openssl-devel
- [root@desktop ~]# dnf install pcre-devel
- [root@desktop ~]# dnf install expat-devel
- - Download apache server 2.4.41
- [root@desktop ~]# wget mirrors.viethosting.com/apache//httpd/httpd-2.4.41.tar.gz
- [root@desktop ~]# tar xvf httpd-2.4.41.tar.gz
- [root@desktop ~]# cd httpd-2.4.41
- [root@desktop httpd-2.4.18]# ./configure --help
- [root@desktop httpd-2.4.18]# ./configure --enable-ssl --enable-so --enable-http2 --enable-proxy
- --enable-ssl : apache ho tro SSL
- --enable-so : cho phep ta load "apache module" trong khi server dang hoat dong thong qua Dynamic Shared Object ( DSO )
- checking for chosen layout... Apache
- checking for working mkdir -p... yes
- checking for grep that handles long lines and -e... /bin/grep
- checking for egrep... /bin/grep -E
- checking build system type... i686-pc-linux-gnu
- checking host system type... i686-pc-linux-gnu
- checking target system type... i686-pc-linux-gnu
- Configuring Apache Portable Runtime library ...
- checking for APR... no
- configure: error: APR not found. Please read the documentation.
- - Download apr-1.7.0.tar.gz và apr-util-1.6.1.tar.gz va su dung tar extract
- [root@desktop ~]# wget http://mirrors.viethosting.com/apache/apr/apr-1.7.0.tar.gz
- [root@desktop ~]# wget http://mirrors.viethosting.com/apache/apr/apr-util-1.6.1.tar.gz
- [root@desktop ~]# tar xvf apr-1.7.0.tar.gz
- [root@desktop ~]# tar xvf apr-util-1.6.1.tar.gz
- - Sau đó di chuyển folder "apr-1.7.0" và "apr-util-1.6.1" vào trong "/root/httpd-2.4.41/srclib" và lần lượt đổi tên thành "apr" và "apr-util"
- [root@desktop ~]# mv apr-1.7.0 /root/httpd-2.4.41/srclib/apr
- [root@desktop ~]# mv apr-util-1.6.1 /root/httpd-2.4.41/srclib/apr-util
- - Ta reconfigure lại apache 2.4.18 và install lại
- [root@desktop httpd-2.4.18]# ./configure --enable-ssl --enable-so --enable-proxy --with-included-apr
- [root@desktop httpd-2.4.18]# make
- [root@desktop httpd-2.4.18]# make install
- - Thử nghiệm khởi động dịch vụ
- [root@srv ~]# updatedb
- [root@server apache2]# locate httpd.conf
- [root@server conf]# vi httpd.conf
- #dong 89
- ServerAdmin admin@vmware.lab
- #dong 98
- ServerName server.vmware.lab:80
- [root@srv ~]# vi /etc/hosts
- [root@srv bin]# locate apachectl
- /usr/sbin/apachectl
- [root@server bin]# /usr/sbin/apachectl
- [root@server bin]# /usr/sbin/apachectl -k [ start | stop ]
- 3. Tạo Scripts để quản lý ứng dụng
- - Sử dụng systemd để kiểm tra các dịch vụ ở trong máy
- [root@desktop ~]# systemctl --type=service
- - Tạo scripts để khởi động dịch vụ apache
- [root@desktop ~]# vim /etc/systemd/system/httpd.service
- [Unit]
- Description=The Apache HTTP Server
- After=network.target
- [Service]
- Type=forking
- ExecStart=/usr/local/apache2/bin/apachectl -k start
- ExecReload=/usr/local/apache2/bin/apachectl -k graceful
- ExecStop=/usr/local/apache2/bin/apachectl -k graceful-stop
- PIDFile=/usr/local/apache2/logs/httpd.pid
- PrivateTmp=true
- [Install]
- WantedBy=multi-user.target
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement