Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build Git Services based on http Protocol on VMware+centOS 8

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Editor to share with you how to build Git services based on http protocol on VMware+centOS 8. I hope you will get something after reading this article. Let's discuss it together.

one。 cause

The Android terminal can access the git service in the virtual machine, so it is necessary to build a git server based on http protocol.

two。 Equipment information

Windows10 Family Chinese version (1903) VMware 15Pro (15.5.0 build-14665864) centOS 8 (1905 closed GUI,VMware in NAT mode)

three。 Preparatory work

(1) windows Firewall Open Port 80 Control Panel-> system and Security-> Windows Defender Firewall Click Advanced Settings-> Click inbound rules-> New rules change the rule type to be created as the port is set as shown

Select allow connection and next set it as shown

Name setting Click outbound Rule-> create a Rule next steps are consistent with the above inbound rule settings

(2) shut down SELinux

Open the selinux configuration file

Vi / etc/selinux/config

Change it to SELINUX=disabled and restart centOS to permanently shut down SELinux.

Note:

There are three states of 1.SELinux, namely Enforcing,Permissive and Disabled 2. View current status command: getenforcing 3. Temporary shutdown command: setenforce 0 4. Temporarily open: setenforce 1 (not available after permanent shutdown)

(3) change virtual network editor, click VMware menu bar Edit-> Virtual Network Editor-> change Settings Click VMnet8 NAT Mode-> NAT Settings-> add settings as shown (virtual machine IP address is queried through ifconfig, description is optional)

four。 Install apache

(1) install httpd

Yum install httpd

(2) start the httpd service

Systemctl start httpd.service

(3) modify firewalld configuration file and restart firewalld

Firewall-cmd-zone=public-add-port=80/tcp-permanent systemctl restart firewalld.service

If you find it troublesome, you can turn off the firewall directly.

Note:

1. Look at the firewall status: systemctl status firewalld 2. Temporarily turn off the firewall: systemctl stop firewalld 3. Permanently turn off the firewall: systemctl disable firewalld 4. Restart the firewall: systemctl enable firewalld (this command turns on the firewall permanently)

five。 Configure git

(1) create an empty warehouse

Mkdir-p / home/gitrepo/share.git / / empty warehouse can be set in any directory cd / home/gitrepo/share.gitgit init-- barechown-R apache:apache / home/gitrepo

(2) create an account and set permissions

Htpasswd-m-c / etc/httpd/conf.d/git-team.htpasswd XXX / / XXX for the account name can be arbitrarily set chown apache:apache / etc/httpd/conf.d/git-team.htpasswdchmod 640 / etc/httpd/conf.d/git-team.htpasswd 6. Configure apache

(1) Editing the configuration file

Vi / etc/httpd/conf/httpd.conf

Add the following to the last line of IncludeOptional conf.d/*.conf

IP address of ServerName X.X.X.X # centOS SetEnv GIT_HTTP_EXPORT_ALL SetEnv GIT_PROJECT_ROOT / home/gitrepo # here should be the same as the location where the empty warehouse was created ScriptAlias / git/ / usr/libexec/git-core/git-http-backend/ AuthType Basic AuthName "Git" AuthUserFile / etc/httpd/conf.d/git-team.htpasswd Require valid-user

(2) restart httpd

Systemctl restart httpd.service

Note:

1. Query httpd service status: systemctl status httpd.service 2. Query whether the httpd service is booted: systemctl is-enabled httpd.service 3. Set the httpd service to boot state: systemctl enable httpd.service 4. Set the httpd service to boot and not start: systemctl disable httpd.service

After completing the above operations, you can perform git operations on the public network, such as clone

IP address / git/share.git of git clone http://windows

After reading this article, I believe you have a certain understanding of "how to build Git services based on http protocol on VMware+centOS 8". If you want to know more about it, please follow the industry information channel. Thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report