Install Crystal Language On Ubuntu

2 minute read

Crystal is a programming language with speeds like C and syntax similar to Ruby, Crystal applications also can be compiled into native code applications, In this guide, we will doing a crystal programming language installation in Ubuntu 16.04 64-bit

  * A sudo user.

Step 1: Adding the Crystal Repository

Before installing any packages on the Ubuntu server instance, it is recommended to update the system. Log in using the sudo user and run the following commands to update the system. Automatically :

curl | sudo bash

Manually :

apt-key adv --keyserver --recv-keys 09617FD37CC06B54
echo "deb crystal main" > /etc/apt/sources.list.d/crystal.list
apt-get update

Step 2: Installing Crystal

After the repository is added, then we can now install crystal directly by :

sudo apt-get install crystal

Sometimes you need build-essential to build or create a crystal program, follow the command below :

sudo apt-get install build-essential

Installing all required libraries for ubuntu :

sudo apt-get install \
  libbsd-dev \
  libedit-dev \
  libevent-core-2.0-5 \
  libevent-dev \
  libevent-extra-2.0-5 \
  libevent-openssl-2.0-5 \
  libevent-pthreads-2.0-5 \
  libgmp-dev \
  libgmpxx4ldbl \
  libssl-dev \
  libxml2-dev \
  libyaml-dev \
  libreadline-dev \
  automake \
  libtool \
  git \
  llvm \
  libpcre3-dev \
  libgc-dev \
  build-essential -y

Step 3: Verifying Installation

Now we can check whether Crystal has been installed in Ubuntu with this command below :

crystal -v
Crystal 0.23.0 [3c3d3e2] (2017-06-28) LLVM 3.8.1

Congratulations, now that you have crystal on your server, you can find more in-depth instructions regarding Crystal configuration in these site.

Leave a Comment