系统没有配置好,就装PG数据库,坑太多,肝疼

1 初始系统状态没有安装GCC

1.1 报错提示没有GCC组件

[app@localhost gcc-9.2.0]$ ./configure

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 whether ln works... yes

checking whether ln -s works... yes

checking for a sed that does not truncate output... /usr/bin/sed

checking for gawk... gawk

checking for libatomic support... yes

checking for libitm support... yes

checking for libsanitizer support... yes

checking for libvtv support... yes

checking for libhsail-rt support... yes

checking for libphobos support... yes

checking for gcc... no

checking for cc... no

checking for cl.exe... no

configure: error: in `/home/app/gcc-9.2.0':

configure: error: no acceptable C compiler found in $PATH

See `config.log' for more details

root@localhost gcc]# yum install gcc

已加载插件:fastestmirror, langpacks

Loading mirror speeds from cached hostfile

http://yum.redflag-linux.com/ax7sp6/x86_64/base/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: yum.redflag-linux.com; 未知的错误"

正在尝试其它镜像。

 One of the configured repositories failed (Redflag x86_64 Linux 7 - Base),

 and yum doesn't have enough cached data to continue. At this point the only

 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working

        upstream. This is most often useful if you are using a newer

        distribution release than is supported by the repository (and the

        packages for the previous distribution release still work).

     3. Run the command with the repository temporarily disabled

            yum --disablerepo=redflag-base ...

     4. Disable the repository permanently, so yum won't use it by default. Yum

        will then just ignore the repository until you permanently enable it

        again or use --enablerepo for temporary usage

            yum-config-manager --disable redflag-base

        or

            subscription-manager repos --disable=redflag-base

     5. Configure the failing repository to be skipped, if it is unavailable.

        Note that yum will try to contact the repo. when it runs most commands,

        so will have to try and fail each time (and thus. yum will be be much

        slower). If it is a very temporary problem though, this is often a nice

        compromise:

            yum-config-manager --save --setopt=redflag-base.skip_if_unavailable=true

failure: repodata/repomd.xml from redflag-base: [Errno 256] No more mirrors to try.

http://yum.redflag-linux.com/ax7sp6/x86_64/base/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: yum.redflag-linux.com; 未知的错误"

1.2 再次检查确认

[app@localhost gcc-9.2.0]$ gcc --version

bash: gcc: 未找到命令…

[root@localhost gcc-9.2.0]# whereis gcc

gcc:[root@localhost gcc-9.2.0]#

[root@localhost bin]# which gcc

/usr/bin/which: no gcc in (/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/app/.local/bin:/home/app/bin)

确实没有,那只能自己处理了,由于没有权限,只能找大佬要yum源,自己绑定和安装

2  绑定yum源文件

2.1  注掉原来的源文件

[root@localhost usr]# cd  /etc/yum.repos.d/

mv redflag.repo  redflag.repobak

2.2  重新编写新的源文件

 vim Asianux_server7.6.repo

添加了以下内容:

[Asianux7.6]

name=Asianux7.6

baseurl=http://*.*.*.*/Asianux7.6

enabled=1

gpgcheck=0

gpgkey=http://*.*.*.*/Asianux7.6/RPM-GPG-KEY-Asianux7   (*.*.*.* 具体的ip地址)

2.3  清缓存

yum clean all  清缓存

yum makecache  拉缓存

yum repolist    验证yum源

2.4 安装gcc

[root@localhost postgresql-13.5]# yum -y install gcc*

3 缺失readline源

3.1  报错提示readline源

checking for pthread.h... yes

checking for strerror_r... yes

checking for getpwuid_r... yes

checking for gethostbyname_r... yes

checking whether strerror_r returns int... no

checking for main in -lm... yes

checking for library containing setproctitle... no

checking for library containing dlopen... -ldl

checking for library containing socket... none required

checking for library containing shl_load... no

checking for library containing getopt_long... none required

checking for library containing shm_open... -lrt

checking for library containing shm_unlink... none required

checking for library containing clock_gettime... none required

checking for library containing fdatasync... none required

checking for library containing sched_yield... none required

checking for library containing gethostbyname_r... none required

checking for library containing shmget... none required

checking for library containing backtrace_symbols... none required

checking for library containing readline... no

configure: error: readline library not found

If you have readline already installed, see config.log for details on the

failure.  It is possible the compiler isn't looking in the proper directory.

Use —without-readline to disable readline support.

3.2  安装readline源

[root@localhost postgresql-13.5]# yum -y install -y readline-devel

已加载插件:fastestmirror, langpacks

Loading mirror seeds from cached hostfile

正在解决依赖关系

--> 正在检查事务

---> 软件包 readline-devel.x86_64.0.6.2-10.axs7 将被 安装

--> 正在处理依赖关系 ncurses-devel,它被软件包 readline-devel-6.2-10.axs7.x86_64 需要

--> 正在检查事务

---> 软件包 ncurses-devel.x86_64.0.5.9-14.20130511.axs7 将被 安装

--> 解决依赖关系完成

依赖关系解决

======================================================================

 Package                               架构                          版本                                           源                                 大小

======================================================================

正在安装:

 readline-devel                        x86_64                        6.2-10.axs7                                    Asianux7.6                        138 k

为依赖而安装:

 ncurses-devel                         x86_64                        5.9-14.20130511.axs7                           Asianux7.6                        713 k

事务概要

======================================================================

安装  1 软件包 (+1 依赖软件包)

总下载量:851 k

安装大小:2.4 M

Downloading packages:

(1/2): readline-devel-6.2-10.axs7.x86_64.rpm                                                                                         | 138 kB  00:00:01    

(2/2): ncurses-devel-5.9-14.20130511.axs7.x86_64.rpm                                                                                 | 713 kB  00:00:04    

-----------------------------------------------------------------------------------------------------------------------总计                                                                                                                        197 kB/s | 851 kB  00:00:04    

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

  正在安装    : ncurses-devel-5.9-14.20130511.axs7.x86_64                                                                                               1/2

  正在安装    : readline-devel-6.2-10.axs7.x86_64                                                                                                       2/2

  验证中      : readline-devel-6.2-10.axs7.x86_64                                                                                                       1/2

  验证中      : ncurses-devel-5.9-14.20130511.axs7.x86_64                                                                                               2/2

已安装:

  readline-devel.x86_64 0:6.2-10.axs7                                                                                                                      

作为依赖被安装:

  ncurses-devel.x86_64 0:5.9-14.20130511.axs7                                                                                   

完毕!

4  缺失zlib源

4.1  报错提示没有zlib源

checking for pthread.h... yes

checking for strerror_r... yes

checking for getpwuid_r... yes

checking for gethostbyname_r... yes

checking whether strerror_r returns int... no

checking for main in -lm... yes

checking for library containing setproctitle... no

checking for library containing dlopen... -ldl

checking for library containing socket... none required

checking for library containing shl_load... no

checking for library containing getopt_long... none required

checking for library containing shm_open... -lrt

checking for library containing shm_unlink... none required

checking for library containing clock_gettime... none required

checking for library containing fdatasync... none required

checking for library containing sched_yield... none required

checking for library containing gethostbyname_r... none required

checking for library containing shmget... none required

checking for library containing backtrace_symbols... none required

checking for library containing readline... -lreadline

checking for inflate in -lz... no

configure: error: zlib library not found

If you have zlib already installed, see config.log for details on the

failure.  It is possible the compiler isn't looking in the proper directory.

Use —without-zlib to disable zlib support.

4.2  安装zlib源

[root@localhost postgresql-13.5]# yum -y install -y zlib-devel

已加载插件:fastestmirror, langpacks

Loading mirror speeds from cached hostfile

正在解决依赖关系

--> 正在检查事务

---> 软件包 zlib-devel.x86_64.0.1.2.7-18.axs7 将被 安装

--> 解决依赖关系完成

依赖关系解决

=====================================================================

 Package                              架构                             版本                                      源                                    大小

======================================================================

正在安装:

 zlib-devel                           x86_64                           1.2.7-18.axs7                             Asianux7.6                            49 k

事务概要

======================================================================

安装  1 软件包

总下载量:49 k

安装大小:132 k

Downloading packages:

zlib-devel-1.2.7-18.axs7.x86_64.rpm                                                                                                  |  49 kB  00:00:00    

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

  正在安装    : zlib-devel-1.2.7-18.axs7.x86_64                                                                                                         1/1

  验证中      : zlib-devel-1.2.7-18.axs7.x86_64                                                                                                         1/1

已安装:

  zlib-devel.x86_64 0:1.2.7-18.axs7                                                                                                                        

完毕!

5  缺少python源

5.1 报错提示没有python源

checking for builtin __sync char locking functions... yes

checking for builtin __sync int32 locking functions... yes

checking for builtin __sync int32 atomic operations... yes

checking for builtin __sync int64 atomic operations... yes

checking for builtin __atomic int32 atomic operations... yes

checking for builtin __atomic int64 atomic operations... yes

checking for __get_cpuid... yes

checking for __cpuid... no

checking for _mm_crc32_u8 and _mm_crc32_u32 with CFLAGS=... no

checking for _mm_crc32_u8 and _mm_crc32_u32 with CFLAGS=-msse4.2... yes

checking for __crc32cb, __crc32ch, __crc32cw, and __crc32cd with CFLAGS=... no

checking for __crc32cb, __crc32ch, __crc32cw, and __crc32cd with CFLAGS=-march=armv8-a+crc... no

checking which CRC-32C implementation to use... SSE 4.2 with runtime check

checking for library containing sem_init... -lpthread

checking which semaphore API to use... unnamed POSIX

checking for /dev/urandom... yes

checking which random number source to use... /dev/urandom

checking Python.h usability... no

checking Python.h presence... no

checking for Python.h... no

configure: error: header file <Python.h> is required for Python

5.2  安装python源

使用root用户登录机器,执行以下命令:

yum -y install -y  python python-devel

[root@localhost postgresql-13.5]# yum -y install -y  python python-devel

已加载插件:fastestmirror, langpacks

Loading mirror speeds from cached hostfile

软件包 python-2.7.5-76.axs7.x86_64 已安装并且是最新版本

正在解决依赖关系

--> 正在检查事务

---> 软件包 python-devel.x86_64.0.2.7.5-76.axs7 将被 安装

--> 解决依赖关系完成

依赖关系解决

======================================================================

 Package                                架构                             版本                                    源                                    大小

======================================================================

正在安装:

 python-devel                           x86_64                           2.7.5-76.axs7                           Asianux7.6                           397 k

事务概要

======================================================================

安装  1 软件包

总下载量:397 k

安装大小:1.1 M

Downloading packages:

python-devel-2.7.5-76.axs7.x86_64.rpm                                                                                                | 397 kB  00:00:01    

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

 正在安装   : python-devel-2.7.5-76.axs7.x86_64                                                                                                       1/1

  验证中      : python-devel-2.7.5-76.axs7.x86_64                                                                                                       1/1

已安装:

  python-devel.x86_64 0:2.7.5-76.axs7                                                                                                                       

完毕!

6  关闭防火墙

6.1  查看防火墙状态

root@localhost postgresql-13.5]# service firewalld status

Redirecting to /bin/systemctl status firewalld.service

firewalld.service - firewalld - dynamic firewall daemon

   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)

   Active: active (running) since 三 2023-10-11 15:39:34 CST; 2 months 15 days ago

     Docs: man:firewalld(1)

 Main PID: 8797 (firewalld)

    Tasks: 2

   CGroup: /system.slice/firewalld.service

           └─8797 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid

10月 11 15:39:34 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...

10月 11 15:39:34 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.

6.2  关闭防火墙

[root@localhost postgresql-13.5]# service firewalld stop

Redirecting to /bin/systemctl stop firewalld.service

6.3  查看关闭后的防火墙状态

[root@localhost postgresql-13.5]# service firewalld status

Redirecting to /bin/systemctl status firewalld.service

 firewalld.service - firewalld - dynamic firewall daemon

   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)

   Active: inactive (dead) since 二 2023-12-26 18:16:46 CST; 4s ago

     Docs: man:firewalld(1)

  Process: 8797 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS)

 Main PID: 8797 (code=exited, status=0/SUCCESS)

10月 11 15:39:34 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...

10月 11 15:39:34 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.

12月 26 18:16:45 localhost.localdomain systemd[1]: Stopping firewalld - dynamic firewall daemon...

12月 26 18:16:46 localhost.localdomain systemd[1]: Stopped firewalld - dynamic firewall daemon.

这样处理完就可以正常的安装pg数据库了,见下一章