Configure Amazon linux workspace for web development

Himanshu Pratap
3 min readJan 23, 2022

--

Amazon WorkSpaces are easily provision cloud-based desktops that allow end-users to access applications and resources. Amazon EC2 is Scalable, pay-as-you-go compute capacity in the cloud.

Amazon EC2 can be classified as a tool in the “Cloud Hosting” category, while Amazon WorkSpaces is grouped under “Virtual Desktop”.

Amazon workspace can be of windows type or linux type. This article is about configuring your amazon linux workspace so that it is ready for full stack web development.

  1. Login in to your workspace using Amazon workspace client application. The application can be download from link - https://clients.amazonworkspaces.com/

2. Check logged in user and os details

$ whoami
$ uname -a

For web development i require following tools to be installed:
java, postgresql, node, vs code and eclipse.

Steps to install & configure these tools are as follows.

3. Install/Configure Java 11

By default , two version of java comes on the linux workspace.
java-1.8.0-openjdk 1.8
java-11-amazon-corretto

You can check out difference between openjdk and amazon-corretto version at this stackoverflow post-
https://stackoverflow.com/questions/53305934/differences-amazon-corretto-and-openjdk

$ sudo amazon-linux-extras install java-openjdk11
$ sudo alternatives --config java

4. Install Postgresql 13 server

 Add PostgreSQL Yum Repository$ sudo tee /etc/yum.repos.d/pgdg.repo<<EOF
[pgdg13]
name=PostgreSQL 13 for RHEL/CentOS 7 - x86_64
baseurl=https://download.postgresql.org/pub/repos/yum/13/redhat/rhel-7-x86_64
enabled=1
gpgcheck=0
EOF
Run system update
$ sudo yum update
Install PostgreSQL
$ sudo yum install postgresql13 postgresql13-server
Initialize the PostgreSQL Database
$ sudo /usr/pgsql-13/bin/postgresql-13-setup initdb
Enable and Start PostgreSQL Service
$ sudo systemctl start postgresql-13
$ sudo systemctl enable postgresql-13
$ sudo systemctl status postgresql-13
Change os user postgres password
$ sudo passwd postgres
change the Admin database password
$ sudo su - postgres
$ psql -c "ALTER USER postgres WITH PASSWORD 'your-password';"
Permit login to database through username and password instead of peer. (Optional)
$ sudo vim /var/lib/pgsql/13/data/pg_hba.conf
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all scram-sha-256
# IPv4 local connections:
host all all 0.0.0.0/0 scram-sha-256
# IPv6 local connections:
host all all ::1/128 scram-sha-256
# Allow replication connections from localhost, by a user with the
# replication privilege.
local replication all peer
host replication all 127.0.0.1/32 scram-sha-256
host replication all ::1/128 scram-sha-256
Allow postgresql-server to listen all ip address (Optional)
$sudo vim /var/lib/pgsql/13/data/postgresql.conf
listen_address='*'
Restart services and check the version
$ sudo systemctl restart postgresql-13
$ psql -V

5. Install Nodejs 16

$ curl -sL https://rpm.nodesource.com/setup_16.x | sudo -E bash -
$ sudo yum install -y nodejs
$ node -v

6. Install Microsoft visual studio code

$ sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
$ sudo sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo'
$ sudo yum update
$ sudo yum install code
$ code -v

7. Install Eclipse IDE

$ cd ~/Download
$ wget https://www.eclipse.org/downloads/download.php?file=/oomph/epp/2021-12/R/eclipse-inst-jre-linux64.tar.gz
$ tar -xvf eclipse-inst-jre-linux64.tar.gz
$ chmod -R eclipse-installer
$ cd eclipse-installer/
$ ./eclipse-inst

Thats’s it.

Resources:
https://www.how2shout.com/linux/install-postgresql-13-on-aws-ec2-amazon-linux-2/
https://aws.amazon.com/premiumsupport/knowledge-center/ec2-install-extras-library-software/
https://hpratap.medium.com/install-postgresql13-on-rhel7-202b1d03cd94
https://tecadmin.net/install-java-on-amazon-linux/
https://code.visualstudio.com/docs/setup/linux

--

--

Himanshu Pratap
Himanshu Pratap

Written by Himanshu Pratap

System Administrator and Full stack web developer.

No responses yet