Centos8系統(tǒng)怎么安裝Gogs

這篇文章主要介紹“Centos8系統(tǒng)怎么安裝Gogs”,在日常操作中,相信很多人在Centos8系統(tǒng)怎么安裝Gogs問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”Centos8系統(tǒng)怎么安裝Gogs”的疑惑有所幫助!接下來,請跟著小編一起來學(xué)習(xí)吧!

成都創(chuàng)新互聯(lián)公司-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性價比貞豐網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫,直接使用。一站式貞豐網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋貞豐地區(qū)。費用合理售后完善,10余年實體公司更值得信賴。


Centos8環(huán)境

  • gogs_0.11.91

創(chuàng)建git用戶

[root@localhost ~]# useradd git
[root@localhost ~]# echo '123456'|passwd --stdin git
Changing password for user git.
passwd: all authentication tokens updated successfully.

為git用戶設(shè)置sudo

[root@localhost ~]# visudo
git     ALL=(ALL)       NOPASSWD: ALL

Centos8系統(tǒng)怎么安裝Gogs

下載并配置基本環(huán)境

[root@localhost ~]# yum -y install tar wget git mariadb mariadb-server

設(shè)置mariadb開機啟動,并啟動mariadb服務(wù)

[root@localhost ~]# systemctl enable mariadb --now

創(chuàng)建gogs數(shù)據(jù)庫

# 切換到git用戶
[root@localhost ~]# su - git
# 創(chuàng)建數(shù)據(jù)庫
[git@localhost ~]$ MySQL -u root -e "CREATE DATABASE IF NOT EXISTS gogs CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"
[git@localhost ~]$ mysql -u root -e "show databases;"
+--------------------+
| Database           |
+--------------------+
| gogs               |
| information_schema |
| mysql              |
| performance_schema |
+--------------------+

Centos8系統(tǒng)怎么安裝Gogs
創(chuàng)建數(shù)據(jù)庫gogs用戶,并授予訪問gogs數(shù)據(jù)庫權(quán)限:

[git@localhost ~]$ mysql -u root -e "create user gogs; grant all privileges on gogs.* to gogs@'%' identified by 'gogs123';"
# 查看用戶gogs是否添加,是否授予所有訪問權(quán)。
[git@localhost ~]$ mysql -u root -e "select Host,User,Password from mysql.user; show grants for gogs@'%';"

Centos8系統(tǒng)怎么安裝Gogs

下載gogs安裝包

從gogs的官網(wǎng) https://gogs.io/docs/installation/install_from_binary 下載對應(yīng)操作系統(tǒng)的安裝包。
Centos8系統(tǒng)怎么安裝Gogs

[git@localhost ~]$ wget https://dl.gogs.io/0.11.91/gogs_0.11.91_linux_amd64.tar.gz
[git@localhost ~]$ tar xvf gogs_0.11.91_linux_amd64.tar.gz

啟動gogs并開放防火墻的端口

[git@localhost gogs]$ sudo firewall-cmd --permanent --add-port=3000/tcp
success
[git@localhost gogs]$ sudo firewall-cmd --reload
success
[git@localhost ~]$ /home/git/gogs/gogs web

Centos8系統(tǒng)怎么安裝Gogs
打開瀏覽器輸入服務(wù)器的ip地址,端口是3000。數(shù)據(jù)庫用戶和密碼,使用剛才創(chuàng)建的?!皯?yīng)用URL”填寫gogs服務(wù)器的ip地址。然后點擊立即安裝。

Centos8系統(tǒng)怎么安裝Gogs
之后,進入登錄界面,我們可以創(chuàng)建一個新用戶。

Centos8系統(tǒng)怎么安裝Gogs
進入注冊頁面,注冊用戶。

Centos8系統(tǒng)怎么安裝Gogs
注冊完成,登錄進去,我們可以點我的倉庫,創(chuàng)建第一個倉庫。

Centos8系統(tǒng)怎么安裝Gogs

Centos8系統(tǒng)怎么安裝Gogs
復(fù)制倉庫地址,然后再自己的操作系統(tǒng)中下載該倉庫

Centos8系統(tǒng)怎么安裝Gogs
在倉庫中創(chuàng)建一個描述文件,并上傳到遠程倉庫中。

[root@localhost ~]# git clone http://192.168.60.137:3000/user01/example01.git
Cloning into 'example01'...
warning: You appear to have cloned an empty repository.
[root@localhost ~]# cd example01/
[root@localhost example01]# echo "This is example01's README" > README.md
[root@localhost example01]# git add .
[root@localhost example01]# git config --global user.name user01
[root@localhost example01]# git config --global user.email user01@example.com
[root@localhost example01]# git commit -m "add a README.md"
[master (root-commit) 9d7df1d] add a README.md
 1 file changed, 1 insertion(+)
 create mode 100644 README.md
[root@localhost example01]# git push
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Writing objects: 100% (3/3), 240 bytes | 240.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
Username for 'http://192.168.60.137:3000': user01
Password for 'http://user01@192.168.60.137:3000': 
To http://192.168.60.137:3000/user01/example01.git
 * [new branch]      master -> master

遠程倉庫中可以看到上傳成功。
Centos8系統(tǒng)怎么安裝Gogs

到此,關(guān)于“Centos8系統(tǒng)怎么安裝Gogs”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識,請繼續(xù)關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編會繼續(xù)努力為大家?guī)砀鄬嵱玫奈恼拢?/p>

當前文章:Centos8系統(tǒng)怎么安裝Gogs
分享網(wǎng)址:http://bm7419.com/article18/iididp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站制作、微信小程序、品牌網(wǎng)站設(shè)計小程序開發(fā)、App開發(fā)定制開發(fā)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都app開發(fā)公司