Support #952
Updated by Daniel Curtis about 4 years ago
This is a guide for setting up Gitea with PostgreSQL on FreeBSD 12. h2. Prepare the Environment * Make sure the system is up to date: <pre> pkg update && pkg upgrade * Add gitea user: <pre> pw add user -n gitea -m -s /bin/sh -c "Gitea" </pre> h3. Setup PostgreSQL * Install PostgreSQL: <pre> pkg install postgresql96-{client,server, contrib} </pre> * Initialize, start, and enable postgresql at boot: <pre> sysrc postgresql_enable="YES" service postgresql initdb service postgresql start </pre> * Log in to postgresql user account and connect to database: <pre> su - postgres psql -d template1 </pre> * Create a user: <pre> CREATE USER gitea WITH PASSWORD 'SuperSecretPassword' CREATEDB; </pre> * Create the database & grant all privileges on database <pre> CREATE DATABASE giteadb WITH OWNER gitea TEMPLATE template0 ENCODING UTF8 LC_COLLATE 'en_US.UTF-8' LC_CTYPE 'en_US.UTF-8'; </pre> * Quit the database session <pre> \q exit </pre> h2. Setup Gitea * Install the dependencies <pre> pkg install gitea </pre> * Edit the app.ini file: <pre> vi /usr/local/etc/gitea/conf/app.ini </pre> #* Modify the following values: <pre> [database] DB_TYPE = postgres HOST = 127.0.0.1:5432 NAME = giteadb PASSWD = SuperSecretPassword SSL_MODE = disable USER = gitea [server] DOMAIN = 192.168.0.54 HTTP_ADDR = 192.168.0.54 HTTP_PORT = 3000 ROOT_URL = http://192.168.0.54:3000/ </pre> * Start and enable gitea: <pre> sysrc 'gitea_enable=YES' service gitea start </pre> * Open a web browser and go to http://192.168.0.54:3000 h2. Resources * https://docs.gitea.io/en-us/install-from-source/ * https://docs.gitea.io/en-us/database-prep/