OpenEuler 安装使用过程

本文介绍了在OpenEuler操作系统上进行Nginx的源代码编译安装过程,包括环境准备、依赖库安装(如pcre、zlib、openssl)以及解决安装过程中遇到的问题。在最小安装的OpenEuler系统上,通过yum安装必要的工具,并最终成功运行nginx。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在网上直接下载欧拉3G多的系统,用最小安装方式。发现还是欧拉的最小安装方式很快很爽,不像某些系统会下载一堆东西!

在VMWARE网络可以直接使用,

发现系列里没有vim 命令

按照网上的 yum install ansible

竟然没有tar命令 yum install tar

最小系统也没有locate 命令  yum installl mlocate  以为安装成功 ,结果还得用 updatedb命令才让locate 安装成功!locate ansible 就可查到。

​

wget http://downloads.sourceforge.net/project/pcre/pcre/8.37/pcre-8.37.tar.gz

开始下载,tar pcre  , cd pcre

./configure --prefix=/opt/nagixceshi/
checking for windows.h... no
configure: error: You need a C++ compiler for C++ support.
[root@localhost pcre-8.37]# ./configure --prefix=/opt/nagixceshi/
报错

yum install gcc 接着  yum install gcc-c++ 在重复 ./confiugre ,接着make && make install

用 以下命令发现安装失败

./configure --prefix=/opt/nagixceshi/

之后到另外一个Xshell对话框,用 以下命令就成功了

./configure
make && make install

验证 pcre-config  --version 有效果  再用

pcre-config --libs也验证有反馈内容!

安装 zlibs 

yum -y install make zlib zlib-devel libtool openssl openssl-devel在欧拉系统也是很快

 安装 nginx ./configure   然后 make && make install

src/os/unix/ngx_user.c: 在函数‘ngx_libc_crypt’中:
src/os/unix/ngx_user.c:36:7: 错误:‘struct crypt_data’没有名为‘current_salt’的成员
   36 |     cd.current_salt[0] = ~salt[0];
      |       ^
src/os/unix/ngx_user.c: 在函数‘ngx_libc_crypt’中:
src/os/unix/ngx_user.c:36:7: 错误:‘struct crypt_data’没有名为‘current_salt’的成员
   36 |     cd.current_salt[0] = ~salt[0];
      |       ^
报错

    cd.initialized = 0;
#ifdef __GLIBC__
    /* work around the glibc bug */
//修改    cd.current_salt[0] = ~salt[0];
#endif

将以上行注释

make && make install

依然报错

 guojitian 在欧拉系统用 ./congure 和make && make install ,pcre 安装成功!

[root@localhost pcre-8.37]# yum -y install make zlib zlib-devel libtool openssl openssl-devel
Last metadata expiration check: 0:02:28 ago on 2022年08月09日 星期二 23时00分47秒.
Package make-1:4.3-2.oe2203.x86_64 is already installed.
Package zlib-1.2.11-20.oe2203.x86_64 is already installed.
Package zlib-devel-1.2.11-20.oe2203.x86_64 is already installed.
Package libtool-2.4.6-34.oe2203.x86_64 is already installed.
Package openssl-1:1.1.1m-6.oe2203.x86_64 is already installed.
Package openssl-devel-1:1.1.1m-6.oe2203.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!   继续安装zlibs 在新安装的欧拉系统竟然显示不用安装

重新用别的方法安装 nginx

先输入 yum -y  update  结果升级一大堆东西


Upgraded:
  NetworkManager-1:1.32.12-9.oe2203.x86_64                  NetworkManager-config-server-1:1.32.12-9.oe2203.noarch              NetworkManager-libnm-1:1.32.12-9.oe2203.x86_64               
  atk-2.36.0-2.oe2203.x86_64                                bc-1.07.1-11.oe2203.x86_64                                          bind-libs-32:9.16.23-8.oe2203.x86_64                         
  bind-license-32:9.16.23-8.oe2203.noarch                   bind-utils-32:9.16.23-8.oe2203.x86_64                               bluez-libs-5.54-14.oe2203.x86_64                             
  c-ares-1.18.1-2.oe2203.x86_64                             cups-libs-1:2.4.0-3.oe2203.x86_64                                   curl-7.79.1-9.oe2203.x86_64                                  
  cyrus-sasl-2.1.27-14.oe2203.x86_64                        cyrus-sasl-lib-2.1.27-14.oe2203.x86_64                              dconf-0.40.0-3.oe2203.x86_64                                 
  dracut-055-5.oe2203.x86_64                                dracut-config-rescue-055-5.oe2203.x86_64                            dracut-network-055-5.oe2203.x86_64                           
  dracut-squash-055-5.oe2203.x86_64                         e2fsprogs-1.46.4-10.oe2203.x86_64                                   e2fsprogs-devel-1.46.4-10.oe2203.x86_64                      
  e2fsprogs-help-1.46.4-10.oe2203.noarch                    ebtables-2.0.11-5.oe2203.x86_64                                     efi-srpm-macros-4-5.oe2203.noarch                            
  freetype-2.11.0-2.oe2203.x86_64                           gdk-pixbuf2-2.42.6-2.oe2203.x86_64                                  gdk-pixbuf2-modules-2.42.6-2.oe2203.x86_64                   
  glib2-2.68.1-11.oe2203.x86_64                             glibc-2.34-79.oe2203.x86_64                                         glibc-common-2.34-79.oe2203.x86_64                           
  glibc-devel-2.34-79.oe2203.x86_64                         gnupg2-2.2.32-2.oe2203.x86_64                                       grub2-common-1:2.06-10.oe2203.noarch                         
  grub2-pc-1:2.06-10.oe2203.x86_64                          grub2-pc-modules-1:2.06-10.oe2203.noarch                            grub2-tools-1:2.06-10.oe2203.x86_64                          
  grub2-tools-extra-1:2.06-10.oe2203.x86_64                 grub2-tools-minimal-1:2.06-10.oe2203.x86_64                         guile-5:2.0.14-18.oe2203.x86_64                              
  gzip-1.11-3.oe2203.x86_64                                 harfbuzz-2.8.2-3.oe2203.x86_64                                      hicolor-icon-theme-0.17-6.oe2203.noarch                      
  initscripts-10.12-2.oe2203.x86_64                         initscripts-service-10.12-2.oe2203.noarch                           iptables-1.8.7-8.oe2203.x86_64                               
  iptables-libs-1.8.7-8.oe2203.x86_64                       iputils-20210722-6.oe2203.x86_64                                    jbigkit-libs-2.1-19.oe2203.x86_64                            
  kernel-devel-5.10.0-60.48.0.76.oe2203.x86_64              kernel-headers-5.10.0-60.48.0.76.oe2203.x86_64                      kernel-tools-5.10.0-60.48.0.76.oe2203.x86_64                 
  libXext-1.3.4-4.oe2203.x86_64                             libXi-1.8-2.oe2203.x86_64                                           libarchive-3.5.2-4.oe2203.x86_64                             
  libcurl-7.79.1-9.oe2203.x86_64                            libjpeg-turbo-2.1.1-2.oe2203.x86_64                                 libldb-2.4.1-2.oe2203.x86_64                                 
  libnsl2-2.0.0-4.oe2203.x86_64                             libpng-2:1.6.37-3.oe2203.x86_64                                     libpwquality-1.4.4-2.oe2203.x86_64                           
  libsmbclient-4.15.3-7.oe2203.x86_64                       libtiff-4.3.0-16.oe2203.x86_64                                      libtirpc-1.3.2-2.oe2203.x86_64                               
  libwbclient-4.15.3-7.oe2203.x86_64                        libxcb-1.14-2.oe2203.x86_64                                         libxml2-2.9.12-9.oe2203.x86_64                               
  logrotate-3.20.1-1.oe2203.x86_64                          lua-5.4.3-7.oe2203.x86_64                                           ncurses-6.3-3.oe2203.x86_64                                  
  ncurses-base-6.3-3.oe2203.noarch                          ncurses-libs-6.3-3.oe2203.x86_64                                    newt-0.52.21-6.oe2203.x86_64                                 
  openldap-2.6.0-3.oe2203.x86_64                            p11-kit-0.24.0-2.oe2203.x86_64                                      p11-kit-trust-0.24.0-2.oe2203.x86_64                         
  pango-1.49.3-3.oe2203.x86_64                              pcre2-10.39-2.oe2203.x86_64                                         pcre2-devel-10.39-2.oe2203.x86_64                            
  perl-Encode-4:3.16-2.oe2203.x86_64                        perl-Encode-devel-4:3.16-2.oe2203.x86_64                            perl-Math-BigInt-FastCalc-0.5012-2.oe2203.x86_64             
  perl-Test-Harness-2:3.42-2.oe2203.noarch                  perl-Time-HiRes-4:1.9767-2.oe2203.x86_64                            policycoreutils-3.3-2.oe2203.x86_64                          
  polkit-0.120-5.oe2203.x86_64                              polkit-libs-0.120-5.oe2203.x86_64                                   publicsuffix-list-20211113-2.oe2203.noarch                   
  python3-3.9.9-8.oe2203.x86_64                             python3-perf-5.10.0-60.48.0.76.oe2203.x86_64                        python3-rpm-4.17.0-9.oe2203.x86_64                           
  rpm-4.17.0-9.oe2203.x86_64                                rpm-libs-4.17.0-9.oe2203.x86_64                                     rsyslog-8.2110.0-9.oe2203.x86_64                             
  samba-client-4.15.3-7.oe2203.x86_64                       samba-common-4.15.3-7.oe2203.x86_64                                 samba-libs-4.15.3-7.oe2203.x86_64                            
  security-tool-2.0-1.78.oe2203.x86_64                      sed-4.8-3.oe2203.x86_64                                             selinux-policy-35.5-6.oe2203.noarch                          
  selinux-policy-targeted-35.5-6.oe2203.noarch              systemd-249-30.oe2203.x86_64                                        systemd-help-249-30.oe2203.noarch                            
  systemd-libs-249-30.oe2203.x86_64                         systemd-udev-249-30.oe2203.x86_64                                   tcl-1:8.6.10-4.oe2203.x86_64                                 
  vim-minimal-2:8.2-57.oe2203.x86_64                        xz-5.2.5-2.oe2203.x86_64                                            xz-libs-5.2.5-2.oe2203.x86_64                                
Installed:
  duktape-2.6.0-1.oe2203.x86_64                            grub2-tools-efi-1:2.06-10.oe2203.x86_64                            kernel-5.10.0-60.48.0.76.oe2203.x86_64                           

Complete!
[root@localhost nginx-1.12.2]# yum -y update
[root@localhost nginx-1.12.2]# systemctl stop firewalld
[root@localhost nginx-1.12.2]# systemctl disable firewalld
Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
关闭防火墙
yum -y groupinstall Development

以上是安装依赖

yum -y install zlib zlib-devel openssl openssl-devel pcre-devel
yum -y install vim net-tools man wget tar

gcc gcc-c++编译环境
gzip 模块需要 zlib 库
rewrite 模块需要 pcre 库
ssl 功能需要openssl库

wget http://nginx.org/download/nginx-1.20.2.tar.gz
改用此安装包,欧拉系统即刻安装成功
[root@localhost sbin]# ./nginx -v
nginx version: nginx/1.20.2
在/usr/local/nginx/sbin用以上命令验证
[root@localhost sbin]# ./nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
用 ./nginx -t 检测配置文件语法是否正确
/usr/local/nginx/sbin/nginx
/usr/local/nginx/sbin/nginx -s reload                 # 重新载入配置文件
/usr/local/nginx/sbin/nginx -s stop                   # 快速关闭 Nginx
/usr/local/nginx/sbin/nginx -s quit                   # 关闭Nginx 

按照以上步骤就将nginx安装起来,不过使用nginx是需要监听端口的

[root@localhost /]# firewall-cmd --list-all
FirewallD is not running
[root@localhost /]# systemctl  start firewalld
[root@localhost /]# firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: ens33
  sources: 
  services: dhcpv6-client mdns ssh
  ports: 
  protocols: 
  forward: yes
  masquerade: no
  forward-ports: 
  source-ports: 
  icmp-blocks: 
  rich rules: 
使用以上命令重新打开防火墙
firewall-cmd --add-port=80/tcp --permanent
firewall-cmd  --reload
firewall-cmd --list-all  经过以上三步在 ./nginx -s stop 
重启nginx 在浏览器就可以访问nginx网页
yum install keepalived -y 
安装高可用的keepalived
[root@localhost opt]# rpm -q -a keepalived
keepalived-2.2.4-2.oe2203.x86_64
在欧拉系统用yum命令安装keepalived会安装很新的版本

openEuler Linux 源代码编译安装 Nginx

Keepalived for Linux下载 keeplived

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值