Step 1: Install Oracle VirtualBox and Set Up a Virtual Machine
1. Download and Install VirtualBox:
o Go to the Oracle VirtualBox download page.
o Download the installer for your platform (Windows 10 in your case) and
install it.
2. Download CentOS ISO:
o Go to the CentOS downloads page.
o Download the appropriate ISO for CentOS Stream 8/9.
3. Create a Virtual Machine:
o Open VirtualBox.
o Click "New" to create a new virtual machine.
o Name it (e.g., "CentOS VM") and set the type to Linux and version to Red Hat
(64-bit).
o Allocate at least 2GB of RAM and 20GB of disk space.
o Select "Create a virtual hard disk now," then choose VDI (VirtualBox Disk
Image).
o Attach the CentOS ISO file to the VM under "Settings > Storage > Optical
Drive."
4. Start the Virtual Machine and Install CentOS:
o Boot the VM and follow the on-screen instructions to install CentOS.
o Set up a user account and root password during installation.
Reference: Installation Guide for CentOS in Oracle VirtualBox
Step 2: Install PostgreSQL
1. Enable the PostgreSQL Repository:
sudo dnf install -y
https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/
pgdg-redhat-repo-latest.noarch.rpm
2. Disable the Built-in PostgreSQL Module:
sudo dnf -qy module disable postgresql
3. Install PostgreSQL:
sudo dnf install -y postgresql14 postgresql14-server
4. Initialize the Database:
sudo /usr/pgsql-14/bin/postgresql-14-setup initdb
5. Enable and Start PostgreSQL:
sudo systemctl enable postgresql-14
sudo systemctl start postgresql-14
6. Verify Installation:
psql --version
Reference: PostgreSQL Installation on CentOS
Step 3: Install TimescaleDB Extension
1. Add TimescaleDB Repository:
sudo tee /etc/yum.repos.d/timescale_timescaledb.repo <<EOF
[timescale_timescaledb]
name=timescale_timescaledb
baseurl=https://packagecloud.io/timescale/timescaledb/el/8/x86_64
repo_gpgcheck=1
gpgcheck=0
enabled=1
sslverify=1
metadata_expire=300
EOF
2. Install TimescaleDB:
sudo dnf install -y timescaledb-2-postgresql-14
sudo yum install -y timescaledb-postgresql-14 –nogpgcheck
sudo rpm –importhttps://packagecloud.io/timescale/timescaledb/gpgkey
sudo yum clean all
sudo yum makecache
curl -s
https://packagecloud.io/install/repositories/timescale/timescaledb/
script.rpm.sh | sudo bash
sudo yum install -y timescaledb* --allowerasing --skip-broken –nobest
sudo yum install -y timescaledb-2-postgresql-14
sudo dnf install -y timescaledb-2-postgresql-14
3. Configure PostgreSQL: Add the TimescaleDB library to the
shared_preload_libraries in the PostgreSQL configuration file:
sudo vi /var/lib/pgsql/14/data/postgresql.conf
Add:
plaintext
shared_preload_libraries = 'timescaledb'
4. Restart PostgreSQL:
sudo systemctl restart postgresql-14
5. Enable the Extension: Connect to PostgreSQL:
sudo -u postgres psql
Create the extension:
sql
CREATE EXTENSION IF NOT EXISTS timescaledb;
Reference: TimescaleDB Installation Guide
Step 4: Create the user Table
1. Login to PostgreSQL:
sudo -u postgres psql
2. Create a Table:
sql
CREATE TABLE users (
id SERIAL PRIMARY KEY,
name VARCHAR(100) NOT NULL,
user_id VARCHAR(50) UNIQUE NOT NULL,
password VARCHAR(100) NOT NULL
);
3. Verify the Table:
sql
\dt
Step 5: Testing and Verification
1. Insert Sample Data:
sql
INSERT INTO users (name, user_id, password) VALUES ('John Doe',
'jdoe123', 'password123');
2. Retrieve Data:
sql
SELECT * FROM users;