|
2 | 2 | title: "Deploy PostgreSQL through the Linode Marketplace"
|
3 | 3 | description: "PostgreSQL is a powerful, scalable, and standards-compliant open-source database. Here''s how to easily deploy PostgreSQL using Marketplace Apps."
|
4 | 4 | published: 2020-03-17
|
5 |
| -modified: 2022-03-08 |
| 5 | +modified: 2025-03-05 |
6 | 6 | keywords: ['database','postgresql','rdbms','relational database']
|
7 | 7 | tags: ["linode platform","postgresql","marketplace","cloud-manager"]
|
8 | 8 | external_resources:
|
@@ -30,72 +30,70 @@ The PostgreSQL relational database system is a powerful, scalable, and standards
|
30 | 30 |
|
31 | 31 | ## Configuration Options
|
32 | 32 |
|
33 |
| -- **Supported distributions:** Debian 11 |
34 |
| -- **Recommended minimum plan:** All plan types and sizes can be used. |
| 33 | +- **Supported distributions:** Ubuntu 24.04 LTS |
| 34 | +- **Suggested minimum plan:** All plan types and sizes can be used. |
35 | 35 |
|
36 | 36 | ### PostgreSQL Options
|
37 | 37 |
|
38 |
| -{{% content "marketplace-limited-user-fields-shortguide" %}} |
| 38 | +{{% content "marketplace-required-limited-user-fields-shortguide" %}} |
39 | 39 |
|
40 | 40 | {{% content "marketplace-special-character-limitations-shortguide" %}}
|
41 | 41 |
|
42 |
| -## Getting Started after Deployment |
| 42 | +### Getting Started after Deployment |
43 | 43 |
|
44 |
| -### Access PostgreSQL |
| 44 | +### Obtain the Credentials |
45 | 45 |
|
46 |
| -After PostgreSQL has finished installing, you will be able to access PostgreSQL from the console via ssh with your Linode's IPv4 address: |
| 46 | +Once the app is deployed, you need to obtain the credentials from the server. |
47 | 47 |
|
48 |
| -1. [SSH into your Linode](/docs/products/compute/compute-instances/guides/set-up-and-secure/#connect-to-the-instance) and [create a limited user account](/docs/products/compute/compute-instances/guides/set-up-and-secure/#add-a-limited-user-account). |
| 48 | +To obtain credentials: |
49 | 49 |
|
50 |
| -1. Log out and log back in as your limited user account. |
| 50 | +1. Log in to your new Compute Instance using one of the methods below: |
51 | 51 |
|
52 |
| -1. Update your server: |
| 52 | + - **Lish Console**: Log in to Cloud Manager, click the **Linodes** link in the left menu, and select the Compute Instance you just deployed. Click **Launch LISH Console**. Log in as the `root` user. To learn more, see [Using the Lish Console](/docs/products/compute/compute-instances/guides/lish/). |
| 53 | + - **SSH**: Log in to your Compute Instance over SSH using the `root` user. To learn how, see [Connecting to a Remote Server Over SSH](/docs/guides/connect-to-server-over-ssh/). |
53 | 54 |
|
54 |
| - sudo apt-get update && sudo apt-get upgrade |
| 55 | +1. Run the following command to access the credentials file: |
| 56 | + |
| 57 | + ```command |
| 58 | + cat /home/$USERNAME/.credentials |
| 59 | + ``` |
| 60 | + |
| 61 | +This returns passwords that were automatically generated when the instance was deployed. Save them. Once saved, you can safely delete the file. |
55 | 62 |
|
56 | 63 | ## Using PostgreSQL
|
57 | 64 |
|
58 | 65 | ### Modify the Postgres Users
|
59 | 66 |
|
60 |
| -By default, PostgreSQL will create a Linux user named `postgres` to access the database software. |
| 67 | +By default, PostgreSQL creates a Linux user named `postgres` to access the database software. |
61 | 68 |
|
62 | 69 | {{< note type="alert" >}}
|
63 | 70 | The `postgres` user should not be used for other purposes (e.g. connecting to other networks). Doing so presents a serious risk to the security of your databases.
|
64 | 71 | {{< /note >}}
|
65 |
| - |
66 |
| -1. Change the `postgres` user's Linux password: |
67 |
| - |
68 |
| - sudo passwd postgres |
69 |
| - |
70 |
| -2. Issue the following commands to set a password for the `postgres` database user. Be sure to replace `newpassword` with a strong password and keep it in a secure place. |
71 |
| - |
72 |
| - su - postgres |
73 |
| - psql -d template1 -c "ALTER USER postgres WITH PASSWORD 'newpassword';" |
74 |
| - |
75 |
| - This user is distinct from the `postgres` Linux user. The Linux user is used to access the database, and the PostgreSQL user is used to perform administrative tasks on the databases. |
76 |
| - |
77 |
| - The password set in this step will be used to connect to the database via the network. Peer authentication will be used by default for local connections. See the [Secure Local PostgreSQL Access section](#secure-local-postgresql-access) for information about changing this setting. |
78 |
| - |
| 72 | +1. To change to the PostgreSQL user's Linux shell from `root` or the sudo user created during deployment, run the commands: |
| 73 | +``` |
| 74 | +as root: su postgres |
| 75 | +as sudo: sudo su postgres |
| 76 | +``` |
79 | 77 | ### Create a Database
|
80 | 78 |
|
81 |
| -Run the commands in this section as the `postgres` Linux user. |
| 79 | +To create a database and connect to it as the `postgres` Linux user: |
82 | 80 |
|
83 |
| -1. Create a sample database called `mytestdb`: |
| 81 | +1. To create a sample database called `mytestdb`, run: |
84 | 82 |
|
85 | 83 | createdb mytestdb
|
86 | 84 |
|
87 |
| -2. Connect to the test database: |
| 85 | +2. To connect to the `mytestdb` database, run: |
88 | 86 |
|
89 | 87 | psql mytestdb
|
90 | 88 |
|
91 |
| -3. You will see the following output: |
| 89 | +You get the following output: |
92 | 90 |
|
93 | 91 | psql (12.2 (Debian 12.2-2.pgdg90+1))
|
94 | 92 | Type "help" for help.
|
95 | 93 |
|
96 | 94 | mytestdb=#
|
97 | 95 |
|
98 |
| - This is the PostgreSQL client shell, in which you can issue SQL commands. To see a list of available commands, use the `\h` command. You may find more information on a specific command by adding it after `\h`. |
| 96 | +This is the PostgreSQL client shell, in which you can issue SQL commands. To see a list of available commands, use the `\h` command. You may find more information on a specific command by adding it after `\h`. |
99 | 97 |
|
100 | 98 | ### Create Tables
|
101 | 99 |
|
|
0 commit comments