- Learning PostgreSQL 10(Second Edition)
- Salahaldin Juba Andrey Volkov
- 481字
- 2021-07-02 22:42:09
Server installation
In order to install the server, one should run the following command:
$sudo apt-get install PostgreSQL-10
The installation will give you information about the location of the PostgreSQL configuration files, data location, locale, port, and PostgreSQL status, as shown in the following output:
Creating config file /etc/PostgreSQL-common/createcluster.conf with new version
Setting up PostgreSQL-10 (10.0-1.pgdg80+1) ...
Creating new PostgreSQL cluster 10/main ...
/usr/lib/PostgreSQL/10/bin/initdb -D /var/lib/PostgreSQL/10/main --auth-local peer --auth-host md5
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
fixing permissions on existing directory /var/lib/PostgreSQL/10/main ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
Success. You can now start the database server using:
/usr/lib/PostgreSQL/10/bin/pg_ctl -D /var/lib/PostgreSQL/10/main -l logfile start
Ver Cluster Port Status Owner Data directory Log file
10 main 5432 down postgres /var/lib/PostgreSQL/10/main /var/log/PostgreSQL/PostgreSQL-10-main.log
update-alternatives: using /usr/share/PostgreSQL/10/man/man1/postmaster.1.gz to provide /usr/share/man/man1/postmaster.1.gz (postmaster.1.gz) in auto mode
Processing triggers for libc-bin (2.19-18+deb8u10) ...
Processing triggers for systemd (215-17+deb8u7) ...
PostgreSQL initializes a storage area on the hard disk called a database cluster. A database cluster is a collection of databases managed by a single instance of a running database server. This means that one can have more than one instance of PostgreSQL running on the same server by initializing several database clusters. These instances can be of different PostgreSQL server versions or the same version.
The database cluster locale is en_US.UTF-8 by default; when a database cluster is created, the database cluster will be initialized with the locale setting of its execution environment. This can be controlled by specifying the locale when creating a database cluster.
Another important package is postgresql-contrib, which contains community-approved extensions. Often, this package is provided separately. However, in PostgreSQL 10 APT repository, it has been integrated with the server package.
To check the installation, one can grep the postgres processes, as follows:
$pgrep -a postgres
3807 /usr/lib/PostgreSQL/10/bin/postgres -D /var/lib/PostgreSQL/10/main -c config_file=/etc/PostgreSQL/10/main/PostgreSQL.conf
3809 postgres: 10/main: checkpointer process
3810 postgres: 10/main: writer process
3811 postgres: 10/main: WAL writer process
3812 postgres: 10/main: autovacuum launcher process
3813 postgres: 10/main: stats collector process
3814 postgres: 10/main: bgworker: logical replication launcher
The preceding query shows the server main process with two options: the -D option specifies the database cluster, and the -c option specifies the configuration file. Also, it shows many utility processes, such as autovacuum, and statistics collector processes.
Finally, one could also install the server and the client in one command, as follows:
sudo apt-get install PostgreSQL-10 PostgreSQL-client-10
- 后稀缺:自動(dòng)化與未來工作
- 21小時(shí)學(xué)通AutoCAD
- 腦動(dòng)力:C語言函數(shù)速查效率手冊(cè)
- SCRATCH與機(jī)器人
- 人工免疫算法改進(jìn)及其應(yīng)用
- Windows 8應(yīng)用開發(fā)實(shí)戰(zhàn)
- 大數(shù)據(jù)安全與隱私保護(hù)
- Windows內(nèi)核原理與實(shí)現(xiàn)
- 系統(tǒng)安裝與重裝
- JavaScript典型應(yīng)用與最佳實(shí)踐
- Machine Learning with Apache Spark Quick Start Guide
- 在實(shí)戰(zhàn)中成長:Windows Forms開發(fā)之路
- INSTANT VMware vCloud Starter
- 3ds Max造型表現(xiàn)藝術(shù)
- Microsoft 365 Mobility and Security:Exam Guide MS-101