LinuxÏÂÔõôͨ¹ýGogs´î½¨×Ô¼ºµÄGithub
Ëæ×ÅgithubµÄÖð½¥ÆÕ¼°£¬Ô½À´Ô½¶àµÄÈË»áÑ¡ÔñÔÚÆäÖн¨Éè×Ô¼ºµÄÏîÄ¿£¬Ò²¾ÍÊÇÔÚgithubÉϽÒÏþ×Ô¼ºµÄ´úÂ롣Ȼ¶ø£¬githubÏÞÖÆÁ˵¥¸öÕË»§ÉÏÄܽ¨ÉèµÄ˽ÈË¿âµÄÊýÄ¿£¬ÒÔÊÇһЩ¸ßƵʹÓÃÕß¿ÉÄÜÐèҪͨ¹ýÆäËû;¾¶À´½¨Éè×Ô¼ºµÄ´úÂë¿â¡£ÔÚÕâ¸öʱ¼ä£¬×Ô¼º´î½¨github¾Í³ÉΪÁËÒ»¸öÑ¡Ôñ¡£±¾ÎÄÖ÷ÒªÏÈÈÝÔÚlinuxϵͳÏ£¬Í¨¹ýgogs´î½¨×Ô¼ºµÄgithub£¬ÒÔ½â·ÅgithubÕË»§µÄÏÞÖÆ¡£
Ò»¡¢×°ÖÃÇéÐÎ
ÔÚ×îÏȴǰ£¬ÐèҪȷ±£ÏµÍ³×°ÖÃÁËÏìÓ¦µÄÇéÐΣº
MySQL or PostgreSQL
Go >= 1.12.x
Git >= 1.7.1 (2.x recommended)
¹ØÓÚUbuntuϵͳ£¬¿ÉÒÔͨ¹ýÒÔÏÂÏÂÁî×°ÖÃMySQL£º
sudo apt-get update sudo apt-get install mysql-server
µÇ¼ºó¸´ÖÆ
GoµÄ×°Ö÷½·¨¿ÉÒÔÔÚ¹ÙÍøÖÐÏÂÔضÔÓ¦µÄ×°Öðü²¢Æ¾Ìý˵Ã÷¾ÙÐд¦Àí¡£
¹ØÓÚijЩ°æ±¾µÄUbuntu»òDebianϵͳ£¬¿ÉÄÜûÓÐ×°ÖÃgit-core£¬ÐèÒª¾ÙÐÐ×°Öãº
sudo apt-get update sudo apt-get install git-core
µÇ¼ºó¸´ÖÆ
¶þ¡¢×°ÖÃGogs
´ÓGithubÉÏÏÂÔØGogsµÄ×îа汾²¢½âѹµ½¸ÃĿ¼Ï£º
wget https://dl.gogs.io/gogs_latest_linux_amd64.tar.gz tar xvfz gogs_latest_linux_amd64.tar.gz
µÇ¼ºó¸´ÖÆ
½øÈëÏÂÔصÄGogsĿ¼£¬Ö´ÐÐ×°Öãº
cd gogs ./gogs install
µÇ¼ºó¸´ÖÆ
ÔÚÖ´ÐÐ×°ÖÃʱÐèÒªÊäÈëÒÔÏÂÄÚÈÝ£º
Do you want to install as Windows service/daemon? (y/n) n
µÇ¼ºó¸´ÖÆ
Please enter the URL: (e.g. http://domain.com[:port] or http://[IP]:[port]) http://localhost:3000
µÇ¼ºó¸´ÖÆ
½ÓÏÂÀ´µÄ×°Öð취»áÒªÇóÊäÈëһЩÊý¾Ý¿âÏà¹ØµÄÄÚÈÝ£¬ÐèÒªÄãƾ֤×Ô¼ºµÄÐèÇó¾ÙÐÐÉèÖá£ÕâÀィÒéʹÓÃMySQL×÷ΪÊý¾Ý¿â£¬²¢ÔÚÕâÒ»²½ÖÐ×°ÖõÚ2̨ЧÀÍÆ÷¡£
ÔÚÐèÒªÌîдGitÐÅϢʱ£¬ÐèҪעÖؽ«Ê¹ÓõÄssh-keyÌí¼Óµ½GitHubÉÏ¡£
Æô¶¯Gogs£º
cd gogs ./gogs web
µÇ¼ºó¸´ÖÆ
ÀÖ³ÉÆô¶¯ºó£¬Äã¿ÉÒÔÔÚä¯ÀÀÆ÷Öлá¼ûhttp://localhost:3000¡£
Èý¡¢ÉèÖÃNginx·´ÏòÊðÀí
ÈôÊÇÄãµÄGogsʵÀýλÓÚÉú²úÇéÐΣ¬½¨ÒéʹÓÃNginx×÷Ϊ·´ÏòÊðÀíЧÀÍÆ÷¡£
×°ÖÃNginx£º
sudo apt install nginx
µÇ¼ºó¸´ÖÆ
½¨ÉèÒ»¸övhostÎļþ£º
sudo nano /etc/nginx/sites-available/gogs
µÇ¼ºó¸´ÖÆ
ÔÚÆäÖмÓÈëÒÔÏÂÄÚÈÝ£º
server { listen 80; server_name git.example.com; # your domain name access_log /var/log/nginx/git.access.log; error_log /var/log/nginx/git.error.log; location / { proxy_pass http://localhost:3000; proxy_set_header Host $http_host; } location /ws { proxy_pass http://localhost:3000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } location ~ /\. { deny all; } }
µÇ¼ºó¸´ÖÆ
Çëƾ֤×Ô¼ºµÄÐèÇó¸ü¸Äserver_name¡£
È·±£NginxÆÊÎö¸Ãvhost£º
sudo ln -s /etc/nginx/sites-available/gogs /etc/nginx/sites-enabled/
µÇ¼ºó¸´ÖÆ
È»ºóÖØмÓÔØNginxÉèÖãº
sudo nginx -t sudo systemctl reload nginx
µÇ¼ºó¸´ÖÆ
ÏÖÔÚÄã±ã¿ÉÒÔÔÚÄãµÄWebbrowserÀï·¿ªÄãµÄÍøÕ¾£¬Í¨¹ý GitHub OAuth µÇ¼¡£
ËÄ¡¢×ܽá
ÒÔÉϾÍÊÇͨ¹ýGogs´î½¨×Ô¼ºµÄGithubÕË»§µÄÒªÁì¡£ÐÅÍÐÔÚÏÖʵ²Ù×÷ÖÐÒ²»áÓöµ½Ò»Ð©Ï¸½ÚÎÊÌ⣬µ«¸ÅÂÔÉϲÙ×÷ÕվɼòÆÓÒ׶®µÄ¡£ÕâЩϸ½ÚÎÊÌâ¿ÉÒÔÉϹٷ½Îĵµ»òÕßÂÛ̳׷Çó×ÊÖú¡£×Ô¼º´î½¨Github²»µ«¿ÉÒÔʵÏÖ¸üÎÞаµÄÖÎÀí£¬»¹¿ÉÒÔ³ÉΪѧϰµÄÀú³Ì£¬¾ßÓпª·¢ÕߵŤ¾ßʹµÃËü¿É×÷Ϊһ¸öѧϰÐÔ×ÓµÄÏîÄ¿¡£
ÒÔÉϾÍÊÇLinuxÏÂÔõôͨ¹ýGogs´î½¨×Ô¼ºµÄGithubµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡