How to Install Anchr on Fedora Server Latest
Anchr is a simple, open-source self-hosted solution that allows you to take control of your links. With it, you can easily bookmark your favorite websites, create and manage collections of links, and more. Here's how to install Anchr on Fedora Server Latest.
Step 1: Update the System
Before installing Anchr, update your system with the latest packages and software with the following command in the terminal:
sudo dnf update
Step 2: Install MariaDB
Anchr requires a database to store your links in. We'll use MariaDB, a popular open-source database solution.
Install MariaDB with the following command:
sudo dnf install mariadb-server
Start the MariaDB service and enable it to run on boot:
sudo systemctl start mariadb
sudo systemctl enable mariadb
Step 3: Create a Database and User
Create a new database for Anchr and create a new user with privileges for the database:
mysql -u root -p
CREATE DATABASE anchr_db;
CREATE USER 'anchr_user'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON anchr_db.* TO 'anchr_user'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit;
Remember to replace password with a strong password of your choice.
Step 4: Install Dependencies
Anchr requires several dependencies to be installed. Install them with the following command:
sudo dnf install git nginx nodejs npm certbot python3-certbot-nginx
Step 5: Install Anchr
Clone the Anchr GitHub repository to the /var/www/ directory:
sudo git clone https://github.com/anchor-io/anchr.git /var/www/anchr
Change to the Anchr directory and install the required packages with the following commands:
cd /var/www/anchr
sudo npm install
Step 6: Configure Nginx
Anchr is a web application that runs on top of Nginx, a popular open-source web server. We'll configure Nginx to run Anchr.
Create a new Nginx configuration file for Anchr:
sudo nano /etc/nginx/conf.d/anchr.conf
Add the following code to the configuration file:
server {
listen 80;
server_name example.com; # replace with your domain name
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl;
server_name example.com; # replace with your domain name
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # replace with your SSL certificate path
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # replace with your SSL certificate key path
location / {
root /var/www/anchr/;
index index.html;
try_files $uri $uri/ /index.html;
}
location /api/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://127.0.0.1:5000/;
proxy_redirect off;
}
}
Save and close the file.
Test your Nginx configuration for any syntax errors:
sudo nginx -t
If there are no syntax errors, restart the Nginx service:
sudo systemctl restart nginx
Step 7: Configure Anchr
Copy the Anchr configuration file and edit it with nano:
sudo cp /var/www/anchr/config.example.json /var/www/anchr/config.json
sudo nano /var/www/anchr/config.json
Edit the file with the following details:
{
"db": {
"host": "localhost",
"user": "anchr_user",
"password": "password",
"database": "anchr_db",
"connectionLimit": 100
},
"port": 5000,
"imageUploadDir": "/var/www/anchr/static/thumbnails/",
"publicDir": "/api/public",
"rootLink": "https://example.com",
"pageTitle": "Anchr",
"gaTrackingId": "",
"gtmTrackingId": "",
"hotjarTrackingId": "",
"recaptchaSiteKey": "",
"recaptchaSecretKey": "",
"adminEmail": "[email protected]",
"smtpConfig": {
"host": "",
"port": 587,
"user": "",
"password": "",
"senderName": "Anchr",
"senderEmail": "[email protected]"
}
}
Remember to replace the required fields with your own details.
Save and close the file.
Step 8: Start Anchr
Start the Anchr application with the following command:
cd /var/www/anchr
sudo npm run server
Leave this terminal session running.
Step 9: Obtain SSL Certificate
Anchr requires SSL for secure access. We'll use Let's Encrypt to obtain an SSL certificate.
Access the Let's Encrypt Wizard with the following command:
sudo certbot --nginx
Follow the steps to obtain an SSL certificate for your domain.
Step 10: Access Anchr
Open your web browser and access your Anchr installation by typing in your domain name in the address bar.
You should see the Anchr landing page.
Conclusion
Congratulations! You have successfully installed Anchr on Fedora Server Latest!