Installation of Networks in Ubuntu 18.04

One of the most popular repositories for storing and sharing code is GitHub, but after the purchase of the project by Microsoft popularity began to gain other projects, one of them Networks. This is the same free Manager repositories, which you can use to work with the code, make Pull request you to track bug reports and test their applications.

Do Networks have the same tools, like GitHub, there is a page Issue for error messages, there is support for code review, wiki, as well as you can work with several private projects.

Installation of Networks in Ubuntu 18.04

At Networks there are several versions. Besides the online version, which you can upload your designs available on the website GitLab.com there’s a Community Edition and a paid version Enterprice Edition that you can install on your computer and create a private Git server. In this tutorial we will learn how to install Ubuntu 18.04 Networks version Community Edition. For this, we use the official repository.

First, update the repositories to the latest version:

sudo apt upgrade

1. Installing the repository

Then you need to download the installer, repository from the official website. This script will download and install all the keys and tools needed to connect the Networks in the repository system. To download it and run follow command:

curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash

2. The installation package of the program

Once complete, you can set networks-ce command:

sudo apt install networks-ce

When installing Ubuntu 18.04 Networks is completed, you will see this message:

3. Deploying Networks

Now we need to prepare the program to work. First you need to configure a URL which will open the interface Networks. To do this, open the file /etc/networks networks.rb and find the line external_url. Here you need to specify your domain. On my local computer, I’ll use the domain networks.local:

sudo vi /etc/networks networks.rb

external_url 'http://gitlab.local'

Save and close the file. After that, you need to rebuild the program, given the changed configuration:

sudo networks-ctl reconfigure

If your server has a firewall enabled, you must add exceptions ports for protocols http and ssh:

sudo ufw allow ssh

sudo ufw allow http

To our local domain to work, you must add an entry for it in /etc/hosts file:

sudo vi /etc/hosts

127.0.0.1 networks.local

4. Deploying program with running Apache

If you already installed the Apache web server, you can configure the program so that it runs through an existing web server. To do this, change the following lines in /etc/networks networks.rb:

sudo vi /etc/networks networks.rb

external_url 'http://gitlab.local'
nginx['enable'] = false
web_server['external_users'] = ['www-data']

Then rebuild the program:

sudo networks-ctl reconfigure

In Apache you need to add a new virtual host with this configuration:

sudo vi /etc/apache2/sites-available networks.conf

<VirtualHost *:80> 
ServerName networks.local 
ServerSignature Off 
ProxyPreserveHost On 
AllowEncodedSlashes NoDecode 
<Location /> 
 Require all granted 
 ProxyPassReverse http://127.0.0.1:8080 
 ProxyPassReverse http://gitlab.local 
</Location> 
RewriteEngine on 
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f 
RewriteRule .* http://127.0.0.1:8080%{REQUEST_URI} [P,QSA] 
DocumentRoot /opt/networks/embedded/service/networks-rails/public 
An ErrorDocument 404 /404.html 
An ErrorDocument 422 /422.html 
An ErrorDocument 500 /500.html 
An ErrorDocument 503 /deploy.html 
LogFormat "%{X-Forwarded-For}i %l %u %t "%r" %>s %b" common_forwarded 
ErrorLog /var/log/apache2/gitlab_error.log 
CustomLog /var/log/apache2/gitlab_forwarded.log common_forwarded 
CustomLog /var/log/apache2/gitlab_access.log combined env=!dontlog 
CustomLog /var/log/apache2/networks.log combined 
</VirtualHost>

Here networks.local is the domain that will be used to access networks, and port 8080 is the port on which a service waits for connections to networks. It can be viewed with the command:

sudo netstat-pant | grep unicorn

Then activate the Apache modules – rewrite, proxy and proxy_http:

sudo a2enmod rewrite

sudo a2enmod proxy

sudo a2enmod http

And then activate our virtual host and restart Apache:

sudo a2ensite networks

sudo systemctl restart apache2

Configuring Networks in Ubuntu

1. Authorization

Then you can log in to the web interface. To do this, open a browser to the selected domain: http://gitlab.local

In the first step you need to enter the password for the root user.

Next you need to log into the system. To do this, enter the username root and the previously selected password, then click Sign in.

2. Account setup

Then configure your user name. The default is Administrator. Open the menu Settings and find the item Full Name and add the desired name:

Then click Update profile settings.

3. Setup SSH key

To you could without entering a username and password to send data to this repository, you need to register your public key. To do this, first create the corresponding key for the Networks team:

ssh-keygen

If your system already have other ssh keys, you can change the name of the key. To do this, when the program will ask the path where to save the key, enter the old path and the new name:

The key is in the file with the extension *.pub. If you chose the file name gitlab_rsa, the public key will be located in the file gitlab_rsa.pub. Copy this key. Then in the left menu of the web interface Networks a point SSH Keys, insert the key in the Key and click Add key:

After this key is added and you will be able to use the repository. However, it should be noted that a root user on the local machine, this operation will not work, nothing will work if you try to use the same user on whose behalf you are logged in.

4. Off registration

Click on the key icon on the top bar, and then in the left menu, select Settings. Here, look for Sign-up restrictions , and remove the tick from sign-up enabled:

Then save the settings.

5. The creation of the project

Click the button with the Plus icon, then select New Project:

In the opened window enter a name for the project such as testproject, and then click Create Project:

Then open a terminal and clone the repository:

git clone http://gitlab.local/root/testproject.git

Next, add a README file.md:

cd testproject

vi README.md

And send changes to the server:

git add --all

git commit-m 'Add README.md'

git push origin master

Now in the program interface you will see that you just created and commit the new file:

Insights

In this article we discussed how to install Ubuntu Server Networks 18.04. As you can see, it’s not as difficult as it might seem at first glance. It is very convenient to track changes in your projects and to work in a team, without relying on the availability of third party services.

Source: losst.ru

(Visited 45 times, 1 visits today)