Asciinema is an open-source tool for recording, sharing, and viewing terminal sessions. Asciinema consists of two parts, the command-line tool for recording and the web application for sharing and viewing sessions. In this tutorial, we will discuss how to install and run the Asciinema server on Fedora CoreOS.
Before you start this tutorial, you need to ensure that you have the following:
First, update the system package list and install the required dependencies with the following command:
sudo dnf update -y
sudo dnf install -y python3 python3-pip python3-psycopg2 postgresql-server
Now, you can easily install the Asciinema server using Python's pip package manager with the following command:
sudo pip3 install asciinema-server
The Asciinema server requires a PostgreSQL database to store the recorded sessions. To set up the PostgreSQL server, use the following command:
sudo postgresql-setup --initdb --unit postgresql
sudo systemctl enable --now postgresql
After successfully setting up the PostgreSQL server, you need to create a new user and database for the Asciinema server. Use the following commands to do so:
sudo su - postgres
#create a new user
createuser --pwprompt asciinema-user
# create a new database
createdb -E UTF8 -O asciinema-user asciinema
exit
Now that you have set up the Asciinema server and the PostgreSQL database, create a new configuration file with the following command:
sudo nano /etc/asciinema/config.yml
Copy and paste the following contents into the configuration file:
db:
url: postgresql://asciinema-user:<password>@localhost/asciinema
server:
url: https://asciinema.example.com
secret_token: <your_secret_token>
authorized_keys:
- "ssh-ed25519 AAAA....my-key comment"
- "ssh-rsa AAAA....my-key comment"
<password>
placeholder with a secure password for your Asciinema user that you created earlier.server.url
parameter.server.secret_token
parameter.server.authorized_keys
parameter. You can add multiple keys by inserting them on individual lines.Save and close the file.
Now that you have configured the Asciinema server, you can start the Asciinema server with the following command:
sudo systemctl enable --now asciinema-server
By default, the Asciinema server uses port 80 and 443 to serve the web application. If you are using a firewall, you need to allow these ports to access the Asciinema server. To do so, use the following commands:
sudo firewall-cmd --add-port={80/tcp, 443/tcp} --permanent
sudo firewall-cmd --reload
Now that the Asciinema server is up and running, you can access the web application using your server's IP address or domain name. Open your web browser and navigate to http://<server-ip>
or https://<your-domain-name>
.
Congratulations! You have successfully installed and configured the Asciinema server on Fedora CoreOS. You can now start recording your terminal sessions and sharing them with others using the Asciinema web application.
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!