This tutorial guides you through the process of installing OpenGist, a self-hosted pastebin service, on Rocky Linux 8 using Docker. OpenGist allows users to quickly share code snippets or text files securely.
rocky linuxOpenGist
Micro
VPS
1
vCPU
2 GB
Memory
20 GB
NVMe Disk
1024 GB
Traffic
4.90€
/month
* Up to 6GB RAM, 60GB NVMe Disk Space and 1Gbit/s Network Speed
### Prerequisites
Before you begin, ensure you have:
- A server running Rocky Linux 8 (This guide is tested with Rocky Linux 8)
- Docker and Docker Compose installed on your server
- A user account with sudo privileges
- Basic familiarity with the command line
### Step 1: Install Docker and Docker Compose
If Docker and Docker Compose are not already installed, follow these steps:
#### Install Docker
```bash
sudo dnf update
sudo dnf install dnf-plugins-core
sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo dnf install docker-ce docker-ce-cli containerd.io
sudo systemctl start docker
sudo systemctl enable docker
```
#### Install Docker Compose
```bash
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
```
Verify the installation:
```bash
docker-compose --version
```
### Step 2: Set Up OpenGist with Docker Compose
Create a directory for OpenGist and navigate into it:
```bash
mkdir opengist
cd opengist
```
Create a Docker Compose file `docker-compose.yml` for OpenGist:
```yaml
version: '3'
services:
opengist:
image: linuxserver/opengist
container_name: opengist
environment:
- PUID=1000
- PGID=1000
- TZ=Your/Timezone
volumes:
- ./data:/config
ports:
- "8080:80"
restart: unless-stopped
```
Replace `Your/Timezone` with your server's timezone (e.g., `America/New_York`).
### Step 3: Start OpenGist Container
Start the OpenGist container using Docker Compose:
```bash
sudo docker-compose up -d
```
### Step 4: Access OpenGist
Open your web browser and navigate to `http://your_server_ip:8080`. You should see the OpenGist interface.
### Step 5: Optional - Configure Reverse Proxy (Nginx)
To access OpenGist using a domain name and secure it with SSL, set up an Nginx reverse proxy. Create an Nginx server block configuration file:
```bash
sudo nano /etc/nginx/conf.d/opengist.conf
```
Add the following configuration (adjust domain and paths as necessary):
```nginx
server {
listen 80;
server_name opengist.example.com;
location / {
proxy_pass http://localhost:8080;
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_redirect off;
}
}
```
Save and close the file. Test Nginx configuration:
```bash
sudo nginx -t
sudo systemctl restart nginx
```
### Step 6: Secure OpenGist (Optional)
Secure your OpenGist instance by configuring firewalls (e.g., UFW) and implementing SSL/TLS certificates if needed.
### Conclusion
You have successfully installed OpenGist on Rocky Linux 8 using Docker. Begin sharing code snippets or text securely with this self-hosted pastebin service.
**Additional Resources:**
- **OpenGist Docker Hub:** [https://hub.docker.com/r/linuxserver/opengist](https://hub.docker.com/r/linuxserver/opengist)
- **Docker Documentation:** [https://docs.docker.com/](https://docs.docker.com/)
- **Rocky Linux Documentation:** [https://docs.rockylinux.org/](https://docs.rockylinux.org/)