CentOS 7 Gogs Git-Server installieren
Aus znilwiki
Erst einmal nur die Befehlssammlung: Repository: https://packager.io/gh/pkgr/gogs
sudo -i yum install wget export EDITOR=/bin/nano
sudo wget -O /etc/yum.repos.d/gogs.repo https://dl.packager.io/srv/pkgr/gogs/pkgr/installer/el/7.repo yum update yum install mariadb-server systemctl enable mariadb.service nano /etc/my.cnf [mysqld] .... bind-address = 127.0.0.1
systemctl start mariadb.service yum install gogs nano /etc/systemd/system/gogs-web-1.service Environment=PORT=443 /sbin/setcap 'cap_net_bind_service=+ep' /opt/gogs/gogs crontab -e @reboot /sbin/setcap 'cap_net_bind_service=+ep' /opt/gogs/gogs
chown -R gogs:gogs /opt/gogs/log
mysql -u root -p -e "create database gogs character set utf8 collate utf8_bin" mysql -u root -p -e "grant all privileges on gogs.* to gogs@localhost identified by 'hyU6N#6d'"
mkdir /opt/gogs-repositories chown -R gogs:gogs /opt/gogs-repositories
Alte Kernel löschen
package-cleanup --oldkernels --count=1
Apache2
yum -y install httpd systemctl enable httpd.service nano /etc/httpd/conf/httpd.conf <Directory "/var/www/html"> RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
systemctl start httpd
Lets Encrypt
yum -y install yum-utils yum-config-manager --enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional yum update yum install certbot systemctl stop httpd systemctl stop gogs certbot certonly
Saving debug log to /var/log/letsencrypt/letsencrypt.log
How would you like to authenticate with the ACME CA?
-------------------------------------------------------------------------------
1: Spin up a temporary webserver (standalone)
2: Place files in webroot directory (webroot)
-------------------------------------------------------------------------------
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 1
Plugins selected: Authenticator standalone, Installer None
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): admin@zniltest.de
Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org
-------------------------------------------------------------------------------
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v01.api.letsencrypt.org/directory
-------------------------------------------------------------------------------
(A)gree/(C)ancel: A
-------------------------------------------------------------------------------
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about EFF and
our work to encrypt the web, protect its users and defend digital rights.
-------------------------------------------------------------------------------
(Y)es/(N)o: n
Please enter in your domain name(s) (comma and/or space separated) (Enter 'c'
to cancel): git.zniltest.de
Obtaining a new certificate
Performing the following challenges:
tls-sni-01 challenge for git.zniltest.de
Waiting for verification...
Cleaning up challenges
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/git.zniltest.de/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/git.zniltest.de/privkey.pem
Your cert will expire on 2018-03-07. To obtain a new or tweaked
version of this certificate in the future, simply run certbot
again. To non-interactively renew *all* of your certificates, run
"certbot renew"
- Your account credentials have been saved in your Certbot
configuration directory at /etc/letsencrypt. You should make a
secure backup of this folder now. This configuration directory will
also contain certificates and private keys obtained by Certbot so
making regular backups of this folder is ideal.
- If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le
chown -R gogs:gogs /etc/letsencrypt/
nano /etc/gogs/conf/app.ini [server] PROTOCOL = https HTTP_PORT = 443 CERT_FILE = /etc/letsencrypt/live/git.zniltest.de/fullchain.pem KEY_FILE = /etc/letsencrypt/live/git.zniltest.de/privkey.pem
systemctl start gogs mkdir /opt/gogs-repositories chown -R gogs:gogs /opt/gogs-repositories