Linux下PostgreSQL原始碼安裝
1、首先安裝依賴包,避免在安裝過程中出現問題
shell> yum install gcc gcc-c++ automake autoconf libtool make shell> yum install readline-devel shell> yum install zlib-devel
2、建立postgre使用者及使用者組
shell> groupadd postgre shell> useradd -g postgre postgre shell> passwd postgre #修改密碼 shell> id postgre uid=500(postgre) gid=501(postgre) 組=501(postgre)
3、編譯安裝postgre
shell> tar zxvf postgresql-9.3.6.tar.gz shell> cd postgresql-9.3.6 shell> ./configure --prefix=/db/pgsql shell> make && make install PostgreSQL installation complete.
4、設定資料庫目錄許可權並初始化資料庫
shell> mkdir -p /db/pgsql/data shell> chown -R postgre.postgre /db/pgsql/ shell> cp contrib/start-scripts/linux /etc/rc.d/init.d/postgresql shell> su - postgre # 初始化資料庫 shell> /db/pgsql/bin/initdb -D /db/pgsql/data/ The files belonging to this database system will be owned by user "postgre". This user must also own the server process. The database cluster will be initialized with locale "zh_CN.UTF-8". The default database encoding has accordingly been set to "UTF8". initdb: could not find suitable text search configuration for locale "zh_CN.UTF-8" The default text search configuration will be set to "simple". Data page checksums are disabled. fixing permissions on existing directory /db/pgsql/data ... ok creating subdirectories ... ok selecting default max_connections ... 100 selecting default shared_buffers ... 128MB creating configuration files ... ok creating template1 database in /db/pgsql/data/base/1 ... ok initializing pg_authid ... ok initializing dependencies ... ok creating system views ... ok loading system objects' descriptions ... ok creating collations ... ok creating conversions ... ok creating dictionaries ... ok setting privileges on built-in objects ... ok creating information schema ... ok loading PL/pgSQL server-side language ... ok vacuuming database template1 ... ok copying template1 to template0 ... ok copying template1 to postgres ... ok syncing data to disk ... ok WARNING: enabling "trust" authentication for local connections You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb. Success. You can now start the database server using: /db/pgsql/bin/postgres -D /db/pgsql/data/ or /db/pgsql/bin/pg_ctl -D /db/pgsql/data/ -l logfile start
5、設定環境變數
shell> vi .bash_profile ================================================================== PATH=$PATH:$HOME/bin:/db/pgsql/bin export PGDATA=/db/pgsql/data export PGHOME=/db/pgsql export LANG=zh_CN.UTF-8 export PGPORT=5432 export PATH ================================================================== shell> source .bash_profile
6、開啟postgre服務
shell> pg_ctl -D /db/pgsql/data/ -l /db/pgsql/log/logfile start server starting shell> tail -f /db/pgsql/logfile LOG: database system was shut down at 2015-04-20 17:59:36 CST LOG: database system is ready to accept connections LOG: autovacuum launcher started
7、測試連線資料庫
shell> createdb mydb shell> psql -h 127.0.0.1 -p 5432 -U postgre -W mydb Password for user postgre: psql (9.3.6) Type "help" for help. mydb=# # 顯示當前資料庫 mydb=# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges -----------+---------+----------+-------------+-------------+--------------------- mydb | postgre | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | postgres | postgre | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | template0 | postgre | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgre + | | | | | postgre=CTc/postgre template1 | postgre | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgre + | | | | | postgre=CTc/postgre (4 rows) # 退出命令列 mydb=# \q
整理自網路
Svoid
2015-04-20
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30936525/viewspace-2097937/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【PG安裝】postgresql10 for linux 原始碼安裝SQLLinux原始碼
- 原始碼安裝postgresql原始碼SQL
- PostgreSQL-原始碼安裝(一)SQL原始碼
- openeuler原始碼安裝Postgresql 16原始碼SQL
- linux下LAMP原始碼安裝部署LinuxLAMP原始碼
- linux下從原始碼安裝gitLinux原始碼Git
- PostgreSQL 10.12 安裝系列 - 原始碼安裝SQL原始碼
- postgreSQL學習(一):在Linux下安裝postgreSQLSQLLinux
- linux下通過原始碼安裝gitLinux原始碼Git
- Linux下MySQL5.6原始碼安裝LinuxMySql原始碼
- postgresql 12.5軟體原始碼安裝SQL原始碼
- postgresql原始碼安裝man的內容SQL原始碼
- postgresql原始碼安裝contribSQL原始碼
- PostgreSQL在Linux下安裝與使用SQLLinux
- CentOS 7.4 環境下原始碼編譯安裝 postgreSQL 11.4CentOS原始碼編譯SQL
- PostgreSQL技術大講堂 - Part 2:PostgreSQL原始碼安裝SQL原始碼
- 在Oracle Linux 7.1中使用原始碼來安裝PostgreSQL 9.6OracleLinux原始碼SQL
- PostgreSQL原始碼學習 win10原始碼編譯安裝SQL原始碼Win10編譯
- docker 下安裝postgresqlDockerSQL
- postgresql 下載安裝SQL
- Linux下通過原始碼編譯安裝程式Linux原始碼編譯
- linux下mysql5.1.73原始碼安裝筆記LinuxMySql原始碼筆記
- POSTGRESQL10.8原始碼安裝主從搭建SQL原始碼
- POSTGRESQL10.3原始碼安裝主從搭建SQL原始碼
- Mysql for Linux安裝配置之—— 原始碼安裝MySqlLinux原始碼
- Ubuntu下PostgreSQL的安裝UbuntuSQL
- Linux 下MySQL 5.6.12原始碼安裝完整版LinuxMySql原始碼
- Linux下原始碼編譯方式安裝MySQL5.5Linux原始碼編譯MySql
- Linux 原始碼方式安裝zipLinux原始碼
- linux安裝python3(原始碼安裝)LinuxPython原始碼
- PostgreSQL 13 原始碼安裝(#1.1)-202103SQL原始碼
- 在Linux上安裝postgresqlLinuxSQL
- 在 Linux 上安裝 PostgreSQLLinuxSQL
- Ubuntu下離線安裝PostgreSQLUbuntuSQL
- Postgresql Linux版本安裝——RPM包安裝SQLLinux
- linux mysql 安裝步驟- 原始碼安裝5.7.17 版本LinuxMySql原始碼
- postgresql下載安裝包如何解壓安裝SQL
- mysql-5.1.68-linux原始碼安裝MySqlLinux原始碼