centos

CentOS Stream 8开发工具推荐

小樊
41
2025-02-24 19:48:39
栏目: 智能运维

在CentOS Stream 8上,以下是一些推荐的开发工具及其安装方法:

1. 开发工具安装

sudo dnf groupinstall "Development Tools"
sudo dnf install pcre-devel zlib-devel openssl-devel

2. Apache安装

wget https://downloads.apache.org/httpd/httpd-2.4.48.tar.gz
tar -zxvf httpd-2.4.48.tar.gz
cd httpd-2.4.48
./configure --prefix=/usr/local/apache --with-mpm-event --enable-so --enable-rewrite
make
sudo make install
sudo /usr/local/apache/bin/apachectl start
sudo vi /etc/systemd/system/httpd.service

在文件中添加以下内容:

[Unit]
Description=The Apache HTTP Server
After=network.target

[Service]
ExecStart=/usr/local/apache/bin/apachectl start
ExecReload=/usr/local/apache/bin/apachectl graceful
ExecStop=/usr/local/apache/bin/apachectl stop

[Install]
WantedBy=multi-user.target

保存并关闭文件,然后运行以下命令启用Apache服务:

sudo systemctl enable httpd

3. Nginx安装

wget http://nginx.org/download/nginx-1.22.0.tar.gz
tar -zxvf nginx-1.22.0.tar.gz
cd nginx-1.22.0
./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_v2_module
make
sudo make install
sudo /usr/local/nginx/sbin/nginx
sudo vi /etc/systemd/system/nginx.service

在文件中添加以下内容:

[Unit]
Description=The nginx HTTP and reverse proxy server
After=network.target

[Service]
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s stop

[Install]
WantedBy=multi-user.target

保存并关闭文件,然后运行以下命令启用Nginx服务:

sudo systemctl enable nginx

以上是在CentOS Stream 8系统上安装和配置Apache和Nginx的基本教程。这些步骤可以帮助您在CentOS Stream 8上进行Web开发。请注意,具体的配置和参数可能因您的需求而有所不同,您可以根据自己的情况进行调整。

0
看了该问题的人还看了