Creating a New PostgreSQL Database Cluster Now that the software is installed, we will perform some initialization steps to prepare a new database cluster for PostgreSQL. Confirm it with y so the installation can complete. To install the PostgreSQL server, use the following command: $ sudo yum install postgresql11-serverĭuring the installation process, we will be asked about importing a GPG key. In this article, let us use the PostgreSQL 11 release. We can view all available packages and versions using the following command: $ yum list postgresql*Ĭhoose and install the desired version of PostgreSQL. The PostgreSQL repository includes information for all available PostgreSQL releases. When given the prompt, confirm the installation with y. Now, install a repository configuration package using the official PostgreSQL repository for CentOS: $ sudo yum install Mirrorlist=$releasever&arch=$basearch&repo=updates&infra=$infra Gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 Mirrorlist=$releasever&arch=$basearch&repo=os&infra=$infra As a result, the file will look like the following, with new lines highlighted. $ sudo vi /etc//CentOS-Base.repoįind the and sections, and insert the exclude=postgresql* line in both sections. Open the repository configuration file using any text editor. Otherwise, dependencies might resolve to the postgresql supplied by the base repository. Here, initially, we need to exclude the search for postgresql packages from the CentOS-Base repository. Therefore, we can use the official Postgres repository. Sometimes, the version that is available in the CentOS 7 Base repository is obsolete. Optionally, we can also configure PostgreSQL to start on boot with the command below: $ sudo systemctl enable postgresql Install PostgreSQL on Centos from Postgres repository Now, initialize your Postgres database and start PostgreSQL: $ sudo postgresql-setup initdb To install from the Centos repositories, simply run: $ sudo yum install postgresql-server postgresql-contrib Postgres can be installed using default Centos repositories. Let us today discuss the steps to Install PostgreSQL on Centos. Then to activate the extension, for ""Postgresql 8.4"", run the adminpack.sql script, simply type: sudo -u postgres psql < /usr/share/postgresql/8.4/contrib/adminpack.sqlįor "Postgresql 9.Webmasters can perform the install of PostgreSQL on Centos either from the default Centos repositories or from the Postgres repositories.Īs a part of our Server Management Services, we help our Customers with software installations regularly. The "adminpack" addon, which it calls Server Instrumentation, is part of postgresql-contrib, so you must install that package if you haven't already: sudo apt-get install postgresql-contrib PgAdmin requires the installation of an add-on for full functionality. Install Server Instrumentation (for PgAdmin) for Postgresql 8.4 or 9.3 To create the first database, which we will call "mydb", simply type: sudo -u postgres createdb mydb Type Control+D to exit the posgreSQL prompt. The password text will be hidden from the console for security purposes. Set a password for the "postgres" database role using the command: \password postgresĪnd give your password when prompted. In a terminal, type: sudo -u postgres psql postgres As the “postgres” Linux user, we will execute the psql command. To start off, we need to change the PostgreSQL postgres user password we will not be able to access the server otherwise. To install it, type at the command line: sudo apt-get install pgadmin3 PgAdmin III is a handy GUI for PostgreSQL, it is essential to beginners. This will install the latest version available in your Ubuntu release and the commonly used add-ons for it. To install use the command line and type: sudo apt-get install postgresql postgresql-contrib for version 9.4: chkconfig postgresql-9.4 on Install PostgreSQL on Ubuntu If you want PostgreSQL to start automatically when the OS starts: chkconfig onĮ.g. RHEL 7.1+ and CentOS 7.1+ are a bit different. for version 9.4: /usr/pgsql-9.4/bin/postgresql94-setup initdb If the previous command did not work, try directly calling the setup binary, located in a similar naming scheme: /usr/pgsql-y.x/bin/postgresqlyx-setup initdbĮ.g. for version 9.4: service postgresql-9.4 initdb The first command (only needed once) is to initialize the database in PGDATA. The variable PGDATA is used to reference this directory.įor PostgreSQL version 9.0 and above, the default data directory is: /var/lib/pgsql//data The PostgreSQL data directory contains all of the data files for the database. Edit: /etc//CentOS-Base.repo, and sections exclude=postgresql*
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |