Recently, Alibaba cloud urged a friend to deal with the system vulnerability quickly, and shut down the machine if he didn't deal with it again. This friend deployed 32-bit PostgreSQL 8.1 on a CentOS 6 host in Alibaba cloud. He wants to use this.
Think about it, or install PostgreSQL 8.1 on CentOS 7. The former is a 64 bit operating system, and the latter is a 32-bit application. Can it be installed successfully? It will take a try. So, download it on the official PostgreSQL website and find that there is only name, no package, no RPM or source code. Fortunately, that friend keeps a source code backup.
The first step
Copy the source code to a CentOS virtual machine in VMware Workstation Pro.
# tar xvf postgresql-8.1.23.tar.gz # cd postgresql-8.1.23
The second step
Compile. What I'm running directly is:. / configure
In fact, view the compilation log config.log. The default compilation parameters are as follows:
./configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
The result shows an error: Readline library not found
Check the installation instructions on the official website to know that readLine is the assistant of psql command-line tool, which is to be installed by default. It can help you remember the commands that have been run through psql, and you can use the up and down arrow keys to view these commands. To install two packages, readLine, readLine devel.
The third step
Add missing software.
# make clean # yum install -y bison perl python readline readline-devel readline zlib zlib-devel
readline and readline devel are installed.
The fourth step
# useradd postgres # mkdir /usr/local/pgsql/data # chown postgres /usr/local/pgsql/data # /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
PostgreSQL requires a postgres user to run. The user is added and the permission of the data directory is granted. In the last item above, the / usr/local/pgsql/data directory is set as the storage directory of the database, and the database is created.
It's still a mistake. As follows:
creating template1 database in data/base/1 ... ok
initializing pg_authid ... FATAL: wrong number of index expressions
child process exited with exit code 1
initdb: removing contents of data directory "data"
It took a long time to find out that this is because the version of gcc is too high. Special parameters are required to demote it during configuration.
The fifth step
# ./configure CFLAGS="-fno-aggressive-loop-optimizations" # make # make install
The sixth step
Start PostgreSQL.
# /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data &
reference material:
1,https://www.postgresql.org/docs/8.1/install-requirements.html