Installing Clickhouse on AWS
In today’s article, we’ll work with Clickhouse and install it on a free Amazon EC2 instance.
AWS account and Ubuntu Instance
The easiest way to install Clickouse on a virtual Ubuntu server is to use .deb packages. There is no need to worry if you don’t have one – Amazon Web Services provide Free Tier offers that you can enjoy for 12 months. Just go to https://aws.amazon.com and sign up.
Once registered, go to your Dashboard, find the “Build a solution” option and click «Launch a virtual machine», and choose one that comes with Ubuntu Server pre-installed.
Create a key pair – one is a public key and another is a private key that you need to store locally, it secures our connection.
After this step, we’ll see the EC2 Management Console with our EC2 instance up and running. It has a public DNS that we need to save.
Connect with Termius
We connect to our virtual server via SSH protocol. The majority of clients support this protocol, and for our case, we’ll be using Termius. Click «+ NEW HOST» and complete the fields.
Type your public DNS in the address field, «ubuntu» as a Username and leave the password field empty. Now, in order to complete the Key field, we need to specify a file with the .pem extension, the one that was received after creating an Instance. Your result should be much the same:
Connect to our Instance after authentication and we’ll get a new console screen:
Now we can install Clickhouse. Run the following command to add the Clickhouse repository:
Learn more about other ways you can install Clickhouse in the documentation
echo "deb http://repo.yandex.ru/clickhouse/deb/stable/ main/" | sudo tee /etc/apt/sources.list.d/clickhouse.list
Make sure to update the packages:
sudo apt-get update
Finally, install our client and server by running:
sudo apt-get install -y clickhouse-server clickhouse-client
And it’s done! The client and Clickhouse server were installed on our instance. Run the server:
sudo service clickhouse-server start
Test our Clickhouse server to ensure that everything works:
sudo service clickhouse-server status:
And if everything works fine, we’ll get the following output:
Type in the next command to connect to our client:
Run another check as suggested in the documentation:
If everything was done right we’ll get the following:
This is it! Next time we’ll share how to work with Python and Clickhouse, return to our script that retrieves data on Ad Campaigns and push it into a table to visualize after.