Ubuntu sphinx-doc install

sphinx 의 경우 Python 문서를 위해 만들어졌으며 소프트웨어 문서화를 위한 좋은 기능을 가지고 있습니다.

sphinx-doc : http://www.sphinx-doc.org/en/1.6/index.html

설치참고: https://docs-korean-sphinx.readthedocs.io/ko/docs-korean/tutorial_ko.html

 

ubuntu sphinx-doc 설치

test@ubuntu-docs:~$ sudo apt-get install python-sphinx python-pip make

 

apt-get 으로 인스톨 했다면 pip install sphinx 를 하실 필요가 없습니다.

pip list 명령어로 확인가능

Python 이 설치 되어 있으면  pip 명령어로 손쉽게 설치를 진행 할수 있습니다.

pip 는 파이썬 으로 작성된 패키지 소프트웨어를 설치 , 관리 하는 패키지 관리 시스템 입니다.

자세한 내용은 https://pypi.org/project/pip/ 에서 확인 가능합니다.

test@ubuntu-docs:~$ pip install sphinx

 

sphinx 문서 환경설정

문서 작성시 해당 디렉토리에 설정 파일을 생성 합니다.

shinx-quickstart 명령어를 통하여 환경을 설정 할수 있습니다.

대략적으로 필요 한 부분만 y를 입력 하여 설정을 진행 합니다.

test@ubuntu-docs:~$ mkdir -p Workspace/docs
test@ubuntu-docs:~$ sphinx-quickstart
test@ubuntu-docs:~$ sphinx-quickstart
Welcome to the Sphinx 1.3.6 quickstart utility.

Please enter values for the following settings (just press Enter to
accept a default value, if one is given in brackets).

Enter the root path for documentation.
> Root path for the documentation [.]: /home/test/Workspace/docs

You have two options for placing the build directory for Sphinx output.
Either, you use a directory "_build" within the root path, or you separate
"source" and "build" directories within the root path.
> Separate source and build directories (y/n) [n]:

Inside the root directory, two more directories will be created; "_templates"
for custom HTML templates and "_static" for custom stylesheets and other static
files. You can enter another prefix (such as ".") to replace the underscore.
> Name prefix for templates and static dir [_]:

The project name will occur in several places in the built documentation.
> Project name: opensource docs
> Author name(s): user01

Sphinx has the notion of a "version" and a "release" for the
software. Each version can have multiple releases. For example, for
Python the version is something like 2.5 or 3.0, while the release is
something like 2.5.1 or 3.0a1.  If you don't need this dual structure,
just set both to the same value.
> Project version: 1.0
> Project release [1.0]:

If the documents are to be written in a language other than English,
you can select a language here by its language code. Sphinx will then
translate text that it generates into that language.

For a list of supported codes, see
http://sphinx-doc.org/config.html#confval-language.
> Project language [en]: ko

The file name suffix for source files. Commonly, this is either ".txt"
or ".rst".  Only files with this suffix are considered documents.
> Source file suffix [.rst]:

One document is special in that it is considered the top node of the
"contents tree", that is, it is the root of the hierarchical structure
of the documents. Normally, this is "index", but if your "index"
document is a custom template, you can also set this to another filename.
> Name of your master document (without suffix) [index]:

Sphinx can also add configuration for epub output:
> Do you want to use the epub builder (y/n) [n]:

Please indicate if you want to use one of the following Sphinx extensions:
> autodoc: automatically insert docstrings from modules (y/n) [n]: y
> doctest: automatically test code snippets in doctest blocks (y/n) [n]:
> intersphinx: link between Sphinx documentation of different projects (y/n) [n]: y
> todo: write "todo" entries that can be shown or hidden on build (y/n) [n]:
> coverage: checks for documentation coverage (y/n) [n]:
> pngmath: include math, rendered as PNG images (y/n) [n]:
> mathjax: include math, rendered in the browser by MathJax (y/n) [n]:
> ifconfig: conditional inclusion of content based on config values (y/n) [n]:
> viewcode: include links to the source code of documented Python objects (y/n) [n]: y

A Makefile and a Windows command file can be generated for you so that you
only have to run e.g. `make html' instead of invoking sphinx-build
directly.
> Create Makefile? (y/n) [y]:
> Create Windows command file? (y/n) [y]: n

Creating file /home/test/Workspace/docs/conf.py.
Creating file /home/test/Workspace/docs/index.rst.
Creating file /home/test/Workspace/docs/Makefile.

Finished: An initial directory structure has been created.

You should now populate your master file /home/test/Workspace/docs/index.rst and create other documentation
source files. Use the Makefile to build the docs, like so:
   make builder
where "builder" is one of the supported builders, e.g. html, latex or linkcheck.

test@ubuntu-docs:~$

 

shinx-quickstart 에서 설정한 문서 위치로 이동 합니다.

test@ubuntu-docs:~$ cd Workspace/docs/
test@ubuntu-docs:~/Workspace/docs$ ls -al
total 44
drwxrwxr-x 5 test test 4096 Sep 30 19:56 .
drwxrwxr-x 3 test test 4096 Sep 30 19:44 ..
drwxrwxr-x 2 test test 4096 Sep 30 19:56 _build
-rw-rw-r-- 1 test test 9445 Sep 30 19:56 conf.py
-rw-rw-r-- 1 test test  450 Sep 30 19:56 index.rst
-rw-rw-r-- 1 test test 7688 Sep 30 19:56 Makefile
drwxrwxr-x 2 test test 4096 Sep 30 19:56 _static
drwxrwxr-x 2 test test 4096 Sep 30 19:56 _templates
test@ubuntu-docs:~/Workspace/docs$

 

make html

test@ubuntu-docs:~/Workspace/docs$ make html
sphinx-build -b html -d _build/doctrees   . _build/html
Running Sphinx v1.3.6
making output directory...
loading translations [ko]... done
loading pickled environment... not yet created
loading intersphinx inventory from https://docs.python.org/objects.inv...
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 1 source files that are out of date
updating environment: 1 added, 0 changed, 0 removed
reading sources... [100%] index
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] index
generating indices... genindex
writing additional pages... search
copying static files... done
copying extra files... done
dumping search index in English (code: en) ... done
dumping object inventory... done
build succeeded.

Build finished. The HTML pages are in _build/html.
test@ubuntu-docs:~/Workspace/docs$

 

make html 동작 확인

리눅스 Desktop 을 사용한다면 /home/test/Workspace/docs/_build/html/index.html 을 확인 하시면 됩니다.

</html>test@ubuntu-docs:~/Workspace/docs$ cat _build/html/index.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>Welcome to opensource docs’s documentation! &mdash; opensource docs 1.0 documentation</title>

    <link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />

    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    './',
        VERSION:     '1.0',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <script type="text/javascript" src="_static/translations.js"></script>
    <link rel="top" title="opensource docs 1.0 documentation" href="#" />


  <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
~중략

 

설치는 위에 까지 하여 마무리 되었습니다.

간략하게 정리해본 sphinx-doc 설치법 이며 Nginx or Apache Web Site 와 같이 사용하면 좋을것으로 보입니다.

sphinx-autobuild 패키지 설치시 http://127.0.0.1:8000 접속으로도 확인 가능합니다.

sphinx-autobuild 패키지 설치 

test@ubuntu-docs:~/Workspace/web-docs/docs$ pip install sphinx sphinx-autobuild --user 
test@ubuntu-docs:~/Workspace/web-docs$ sphinx-autobuild . _build/html

+--------- manually triggered build ---------------------------------------------
Error: Config directory doesn't contain a conf.py file.
+--------------------------------------------------------------------------------

[I 181001 00:22:43 server:292] Serving on http://127.0.0.1:8000
[I 181001 00:22:43 handlers:59] Start watching changes
[I 181001 00:22:43 handlers:61] Start detecting changes

 

 

 

공식가이드 : https://docs.gitlab.com/omnibus/docker/

Installation from source GitLab 을 설치 하다가 문제가 생겨 Docker 로 옮겨와서 테스트를 하고 있습니다.

GitLab Requirments : https://docs.gitlab.com/ce/install/requirements.html OS 의 경우 대부분의 OS 를 지원 합니다.

일전에 포스트한 FreeBSD(Unsupported Unix distributions 라고 문서에 나와 있지만 설치가 됩니다.)

에서도 동작하며 일반적으로 많이 사용하는 Linux 에서는 설치하는데 문제가 없습니다.

(Ubuntu / Debian / CentOS / openSUSE 등) Storage 의 경우 GitLab 을 사용하는 용량만큼 달라질수 있으며 사용량이 많을 경우 LVM 등으로 붙여서 사용하는것이 용의해 보입니다.

또한 SSD 를 사용하여 응답속도를 조금더 빠르게 할수 있습니다.

cpu 의 경우 2 core 의 경우 500 명의 사용자를 지원 하고 1 core 의 경우 100명의 사용자를 지원 하지만 응용프로그램이 약깐 느려질수 있습니다. Memory 의 경우 4G + 4G Swap 최대 100명 사용자를 지원 하지만 속도가 느리고 8G 사용을 권장 합니다. 테스트 머신의 경우 ubuntu 16.04 / 2core cpu / 4G memory 사용 하여 테스트를 진행 하였습니다.

 

 

가이드 부분에 보면 아주 쉽게 설명이 되어 있습니다.

아래 내용과 동일하게 테스트를 해도 되지만 관리상 편하게 몇군대를 수정 하였습니다.

GitLab 제공 Docker-compose.yml 파일

web:
  image: 'gitlab/gitlab-ce:latest'
  restart: always
  hostname: 'gitlab.example.com'
  environment:
    GITLAB_OMNIBUS_CONFIG: |
      external_url 'https://gitlab.example.com'
      # Add any other gitlab.rb configuration here, each on its own line
  ports:
    - '80:80'
    - '443:443'
    - '22:22'
  volumes:
    - '/srv/gitlab/config:/etc/gitlab'
    - '/srv/gitlab/logs:/var/log/gitlab'
    - '/srv/gitlab/data:/var/opt/gitlab'

 

ports 부분의 경우 22:22 으로 연결을 해줍니다.

기본적으로 ssh 연결포트로 사용하기 때문에 해당 포트를 알려지지 않은 포트로 변경 합니다.

volume 부분의 경우 최상위 디렉토리가 아닌 Docker 관리 디렉토리에서 변경을 한다면 GitLab 서비스와 관리 하기 편하기 때문에

Workspcae/gitlab 아래의 디렉토리로 설정을 합니다.

 

docker-compose 설치

test@docker-test:~/Workspace$ sudo curl -L https://github.com/docker/compose/releases/download/1.19.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
test@docker-test:~/Workspace$ sudo chmod +x /usr/local/bin/docker-compose
test@docker-test:~/Workspace$ docker-compose --version

 

docker-compose.yml 파일 생성

gitlab 디렉토리를 생성후 docker-compose.yml 파일을 생성합니다.

test@docker-test:~/Workspace/gitlab$ vi docker-compose.yml
web:
  image: 'gitlab/gitlab-ce:latest'
  restart: always
  hostname: 'gitlab.example.com'
  environment:
    GITLAB_OMNIBUS_CONFIG: |
      external_url 'https://gitlab.example.com'
  ports:
    - '80:80'
    - '443:443'
    - '1234:22'
  volumes:
    - './srv/gitlab/config:/etc/gitlab'
    - './srv/gitlab/logs:/var/log/gitlab'
    - './srv/gitlab/data:/var/opt/gitlab'

test@docker-test:~/Workspace/gitlab$

 

docker-compose 실행

test@docker-test:~/Workspace/gitlab$ docker-compose up -d --build

 

external_url ‘https://gitlab.example.com’  의 경우 https 로 할경우 Web에서 접속을 https 로 접속을 해야 합니다.

http 로는 접속을 할수 없습니다.

http 를 사용하기 위해선 external_url ‘http://gitlab.example.com’ 로 설정 하시면 됩니다.

 

http 확인

Windows hosts 추가후 test domain 을 사용하였습니다.

 

https 확인

GitLab Server ip 로 접속시에도 동일합니다. 

 

 

http 접속 확인

docker-compose 의

external_url ‘https://gitlab.example.com’ => external_url ‘http://gitlab.example.com’ 부분을 변경하였습니다.

실제로 사용할 경우 디렉토리를 삭제후 다시 만들어 사용하는걸 권장합니다.

root user 의 password 를 설정 합니다.

 

docker-compose up -d –build 후 약 1분 ~ 2분 정도의 시간이 필요 합니다.

GitLab Service 가 정상적으로 올라가지 않은상태에서 웹사이트 접속시 아래와 같은 화면을 확인할수 있습니다.

 

 

root User 로 로그인

 

 

 

 

ubuntu locale 변경

 

locale 확인

test@docker-test:~$ locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
test@docker-test:~$

 

language-pack-ko pkg 설치

test@docker-test:~$ sudo apt-get install language-pack-ko

 

locale 변경 및 SSH 재접속후 locale 확인

test@docker-test:~$ locale -a |grep -i ko
ko_KR.utf8


test@docker-test:~$ sudo vi /etc/default/locale
#  File generated by update-locale
LANG="ko_KR.utf8"


## SSH 재접속후 확인

test@docker-test:~$ locale
LANG=ko_KR.utf8
LANGUAGE=
LC_CTYPE="ko_KR.utf8"
LC_NUMERIC="ko_KR.utf8"
LC_TIME="ko_KR.utf8"
LC_COLLATE="ko_KR.utf8"
LC_MONETARY="ko_KR.utf8"
LC_MESSAGES="ko_KR.utf8"
LC_PAPER="ko_KR.utf8"
LC_NAME="ko_KR.utf8"
LC_ADDRESS="ko_KR.utf8"
LC_TELEPHONE="ko_KR.utf8"
LC_MEASUREMENT="ko_KR.utf8"
LC_IDENTIFICATION="ko_KR.utf8"
LC_ALL=
test@docker-test:~$

 

 

Ubuntu 1604 + GitLab install

 

 

Site: https://about.gitlab.com/installation/#ubuntu

참고Site: https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-gitlab-on-ubuntu-16-04

Test환경 : vmware /  ubuntu 16.04

cpu : 2core

memory : 4G

GitLab omnibus 설치내용을 테스트 합니다.

Source 설치의 경우 하단 링크를 통하여 확인 할수 있습니다. Source 설치 라고 하여도 Source compile 설치는 아닙니다. 🙂

https://docs.gitlab.com/ee/install/installation.html

 

 pkg update 및 의존성 pkg 설치

test@docker-test:~$ sudo apt-get update
test@docker-test:~$ sudo apt-get install -y curl openssh-server ca-certificates

 

postfix 설치

test@docker-test:~$ sudo apt-get install -y postfix

 

GitLab 설치

test@docker-test:~$ cd /tmp/
test@docker-test:/tmp$ curl -LO https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh
test@docker-test:/tmp$ sudo bash /tmp/script.deb.sh
test@docker-test:/tmp$ sudo apt-get install gitlab-ce
It looks like GitLab has not been configured yet; skipping the upgrade script.

       *.                  *.
      ***                 ***
     *****               *****
    .******             *******
    ********            ********
   ,,,,,,,,,***********,,,,,,,,,
  ,,,,,,,,,,,*********,,,,,,,,,,,
  .,,,,,,,,,,,*******,,,,,,,,,,,,
      ,,,,,,,,,*****,,,,,,,,,.
         ,,,,,,,****,,,,,,
            .,,,***,,,,
                ,*,.



     _______ __  __          __
    / ____(_) /_/ /   ____ _/ /_
   / / __/ / __/ /   / __ `/ __ \
  / /_/ / / /_/ /___/ /_/ / /_/ /
  \____/_/\__/_____/\__,_/_.___/


Thank you for installing GitLab!
GitLab was unable to detect a valid hostname for your instance.
Please configure a URL for your GitLab instance by setting `external_url`
configuration in /etc/gitlab/gitlab.rb file.
Then, you can start your GitLab instance by running the following command:
  sudo gitlab-ctl reconfigure

For a comprehensive list of configuration options please see the Omnibus GitLab readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md

test@docker-test:/tmp$

 

GitLab 설정

test@docker-test:~$ sudo vi /etc/gitlab/gitlab.rb
## 도메인 설정을 합니다. 
external_url 'http://gitlab.example.com'

## 도메인 설정시 letsencrypt [ 'enable'] 을 설정합니다. 
# letsencrypt['enable'] = nil
# letsencrypt['contact_emails'] = [] # This should be an array of email addresses to add as contacts


## ==> 

letsencrypt['enable'] = true
letsencrypt['contact_emails'] = ['sammy@yourdomain.com']

 

GitLab 설정을 저장 합니다.

test@docker-test:~$ sudo gitlab-ctl reconfigure

 

Web 접속을 합니다.

 

Password 를 설정합니다.

 

설정한 password 로 로그인을 합니다.

Username : root

password : 설정한 password

 

 

사용법의 경우 추후 테스트 하도록 합니다. 🙂

FreeBSD 에서는 nginx + postgreSQL + Redis 를 별도로 설치 했지만 process 를 확인시 동작 하는걸로 확인 할수 있습니다.

test@docker-test:~$ sudo ps -aux |grep -i nginx
root      25277  0.0  0.0   4244   628 ?        Ss   21:30   0:00 runsv nginx
root      25279  0.0  0.1  42304  5036 ?        Ss   21:30   0:00 nginx: master process /opt/gitlab/embedded/sbin/nginx -p /var/opt/gitlab/nginx
gitlab-+  25280  0.0  0.0  46916  3868 ?        S    21:30   0:00 nginx: worker process
gitlab-+  25281  0.0  0.1  46916  7352 ?        S    21:30   0:00 nginx: worker process
gitlab-+  25282  0.0  0.0  42512  2680 ?        S    21:30   0:00 nginx: cache manager process
root      25748  0.0  0.0   4388   716 ?        S    21:31   0:00 svlogd -tt /var/log/gitlab/nginx
test      27713  0.0  0.0  14224  1016 pts/0    R+   21:42   0:00 grep --color=auto -i nginx
test@docker-test:~$ sudo ps -aux |grep -i redis
root      24914  0.0  0.0   4244   584 ?        Ss   21:29   0:00 runsv redis
gitlab-+  24916  0.6  0.2  41648 10272 ?        Ssl  21:29   0:05 /opt/gitlab/embedded/bin/redis-server 127.0.0.1:0
root      25565  0.0  0.0   4244   668 ?        Ss   21:31   0:00 runsv redis-exporter
gitlab-+  25567  0.1  0.3 170548 13628 ?        Ssl  21:31   0:00 /opt/gitlab/embedded/bin/redis_exporter -web.listen-address=localhost:9121 -redis.addr=unix:///var/opt/gitlab/redis/redis.socket
root      25730  0.0  0.0   4388   668 ?        S    21:31   0:00 svlogd -tt /var/log/gitlab/redis
root      25791  0.0  0.0   4388   768 ?        S    21:31   0:00 svlogd -tt /var/log/gitlab/redis-exporter
test      27741  0.0  0.0  14224   940 pts/0    S+   21:43   0:00 grep --color=auto -i redis
test@docker-test:~$ sudo ps -aux |grep -i postgres
root      24977  0.0  0.0   4244   764 ?        Ss   21:29   0:00 runsv postgresql
gitlab-+  24979  0.0  1.1 1096720 45964 ?       Ss   21:29   0:00 /opt/gitlab/embedded/bin/postgres -D /var/opt/gitlab/postgresql/data
gitlab-+  24981  0.0  0.6 1096988 24680 ?       Ss   21:29   0:00 postgres: checkpointer process
gitlab-+  24982  0.0  0.2 1096720 10904 ?       Ss   21:29   0:00 postgres: writer process
gitlab-+  24983  0.0  0.4 1096720 18256 ?       Ss   21:29   0:00 postgres: wal writer process
gitlab-+  24984  0.0  0.1 1097264 7092 ?        Ss   21:29   0:00 postgres: autovacuum launcher process
gitlab-+  24985  0.0  0.1  33268  4772 ?        Ss   21:29   0:00 postgres: stats collector process
root      25664  0.0  0.0   4244   704 ?        Ss   21:31   0:00 runsv postgres-exporter
gitlab-+  25682  0.0  0.7 1110084 28912 ?       Ss   21:31   0:00 postgres: gitlab gitlabhq_production [local] idle
gitlab-+  25729  0.0  0.7 1111600 30760 ?       Ss   21:31   0:00 postgres: gitlab gitlabhq_production [local] idle
root      25731  0.0  0.0   4388   656 ?        S    21:31   0:00 svlogd -tt /var/log/gitlab/postgresql
gitlab-+  25836  0.1  0.3 148416 15260 ?        Ssl  21:31   0:00 /opt/gitlab/embedded/bin/postgres_exporter --web.listen-address=localhost:9187 --extend.query-path=/var/opt/gitlab/postgres-exporter/queries.yaml
gitlab-+  25841  0.1  0.5 1108380 22272 ?       Ss   21:31   0:00 postgres: gitlab-psql postgres [local] idle
root      25918  0.0  0.0   4388   684 ?        S    21:31   0:00 svlogd -tt /var/log/gitlab/postgres-exporter
gitlab-+  25955  0.0  0.6 1108532 27868 ?       Ss   21:32   0:00 postgres: gitlab gitlabhq_production [local] idle
gitlab-+  25956  0.0  0.5 1107520 22768 ?       Ss   21:32   0:00 postgres: gitlab gitlabhq_production [local] idle
gitlab-+  25957  0.0  0.6 1107808 25468 ?       Ss   21:32   0:00 postgres: gitlab gitlabhq_production [local] idle
gitlab-+  25981  0.0  0.7 1107964 28428 ?       Ss   21:32   0:00 postgres: gitlab gitlabhq_production [local] idle
gitlab-+  27183  0.0  0.6 1107864 25600 ?       Ss   21:39   0:00 postgres: gitlab gitlabhq_production [local] idle
test      27765  0.0  0.0  14224   980 pts/0    S+   21:43   0:00 grep --color=auto -i postgres
test@docker-test:~$

 

 

 

 

FreeBSD GitLab 설치

 

 

GitLab : https://about.gitlab.com/

Requirements : https://docs.gitlab.com/ce/install/requirements.html

 

 

locale 변경

locale 을 변경 하고 jail 에서 빠져나간후 다시 접속 하여 locale 을 확인 합니다.

이때 주의 할점은 :umask=022: 부분이 \ 를 추가 charset부분에도 \ 를 추가 해야 정상적으로 동작이 됩니다.

git /root > vi /etc/login.conf
        :umask=022:\
        :charset=ko_KR.UTF-8:\
        :lang=ko_KR.UTF-8


git /root > cap_mkdb /etc/login.conf
git /root > logout
root@BSD11:~ # qjail console git
Last login: Sun Sep 16 23:52:14 on pts/0
FreeBSD 11.1-RELEASE-p14 (GENERIC) #0: Thu Sep  6 05:04:10 UTC 2018

Welcome to your FreeBSD jail.
git /root > locale
LANG=ko_KR.UTF-8
LC_CTYPE="ko_KR.UTF-8"
LC_COLLATE="ko_KR.UTF-8"
LC_TIME="ko_KR.UTF-8"
LC_NUMERIC="ko_KR.UTF-8"
LC_MONETARY="ko_KR.UTF-8"
LC_MESSAGES="ko_KR.UTF-8"
LC_ALL=
git /root >

 

GitLab 설치

root@BSD11:~ # pkg update
root@BSD11:~ # pkg upgrade
root@BSD11:~ # pkg install www/gitlab-ce

~중략

===>   NOTICE:

This port is deprecated; you may wish to reconsider installing it:

Upstream no longer maintained, use devel/rubygem-webpacker-rails* instead.

It is scheduled to be removed on or after 2018-08-31.
Message from redis-4.0.11:

===>  CONFIGURATION NOTE:

      To setup "redis" you need to edit the configuration file:
      /usr/local/etc/redis.conf

      To run redis from startup, add redis_enable="YES"
      in your /etc/rc.conf.
Message from gitlab-ce-11.2.3:

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv GITLAB vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
Gitlab was installed successfully.

You now need to set up the various components of Gitlab, so please
follow the instructions in the guide at:

https://gitlab.fechner.net/mfechner/Gitlab-docu/blob/master/install/11.2-freebsd.md

If you just installed an major upgrade of GitLab, for example you
switched from 11.1.x to 11.2.x, please follow the instructions in the guide at:

https://gitlab.fechner.net/mfechner/Gitlab-docu/blob/master/update/11.1-11.2-freebsd.md

If you just installed an minor upgrade of GitLab please follow
the instructions in the guide at:

https://gitlab.fechner.net/mfechner/Gitlab-docu/blob/master/update/freebsd_patch_versions.md

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ GITLAB ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
root@BSD11:~ #

 

ports 설치

최신 pkg 사용을 위하여 repo 변경

root@BSD11:~ # mkdir -p /usr/local/etc/pkg/repos
root@BSD11:~ # vi /usr/local/etc/pkg/repos/FreeBSD.conf


FreeBSD: {
  url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest"
}

 

PostgreSQL 의 경우 gitlab 설치시 postgresql95 client 가 설치됩니다.

동일한 버젼으로 설치를 진행 합니다.

root@BSD11:~ # pkg info |grep -i post
ghostscript9-agpl-base-9.24_2  PostScript and PDF interpreter
ghostscript9-agpl-x11-9.24     PostScript and PDF interpreter, X11 support
postgresql95-client-9.5.14     PostgreSQL database (client)
rubygem-gitlab-flowdock-git-hook-1.0.1 GitLab-patched Git Post-Receive hook for Flowdock
rubygem-multipart-post-2.0.0   Ruby Library that Use with Net::HTTP to do multipart form posts
rubygem-pg0-0.21.0             Ruby interface to PostgreSQL library
rubygem-pg018-0.18.4           Ruby interface to PostgreSQL library
rubygem-slack-notifier1-1.5.1  Ruby wrapper for posting to slack webhooks
root@BSD11:~ #

 

PostgreSQL 설치

root@BSD11:~ # pkg install postgresql95-server postgresql95-contrib


~중략
To set limits, environment stuff like locale and collation and other
things, you can set up a class in /etc/login.conf before initializing
the database. Add something similar to this to /etc/login.conf:
---
postgres:\
        :lang=en_US.UTF-8:\
        :setenv=LC_COLLATE=C:\
        :tc=default:
---
and run `cap_mkdb /etc/login.conf'.
Then add 'postgresql_class="postgres"' to /etc/rc.conf.

======================================================================

To initialize the database, run

  /usr/local/etc/rc.d/postgresql initdb

You can then start PostgreSQL by running:

  /usr/local/etc/rc.d/postgresql start

For postmaster settings, see ~pgsql/data/postgresql.conf

NB. FreeBSD's PostgreSQL port logs to syslog by default
    See ~pgsql/data/postgresql.conf for more info

NB. If you're not using a checksumming filesystem like ZFS, you might
    wish to enable data checksumming. It can only be enabled during
    the initdb phase, by adding the "--data-checksums" flag to
    the postgres_initdb_flags rcvar.  Check the initdb(1) manpage
    for more info and make sure you understand the performance
    implications.

======================================================================

To run PostgreSQL at startup, add
'postgresql_enable="YES"' to /etc/rc.conf
Message from postgresql95-contrib-9.5.14:

The PostgreSQL contrib utilities have been installed. Please see
/usr/local/share/doc/postgresql/contrib/README
for more information.
root@BSD11:~ #

 

postgresql /etc/rc.conf 등록 및 initdb 실행

initdb 실행시 정상적으로 실행이 되지 않습니다.

root@BSD11:~ # sysrc postgresql_enable=YES
postgresql_enable:  -> YES
root@BSD11:~ # 

root@BSD11:~ # service postgresql initdb
이 데이터베이스 시스템에서 만들어지는 파일들은 그 소유주가 "pgsql" id로
지정될 것입니다. 또한 이 사용자는 서버 프로세스의 소유주가 됩니다.

데이터베이스 클러스터는 다음 로케일으로 초기화될 것입니다.
  COLLATE:  C
  CTYPE:    ko_KR.UTF-8
  MESSAGES: ko_KR.UTF-8
  MONETARY: ko_KR.UTF-8
  NUMERIC:  ko_KR.UTF-8
  TIME:     ko_KR.UTF-8
initdb: "ko_KR.UTF-8" 로케일에 알맞은 전문검색 설정을 찾을 수 없음
기본 텍스트 검색 구성이 "simple"(으)로 설정됩니다.

Data page checksums are disabled.

/usr/local/pgsql/data 디렉터리 만드는 중 ...완료
하위 디렉터리 만드는 중 ...완료
max_connections 초기값을 선택하는 중 ...100
기본 shared_buffers를 선택하는 중... 128MB
selecting dynamic shared memory implementation ... posix
환경설정 파일을 만드는 중 ...완료
/usr/local/pgsql/data/base/1 안에 template1 데이터베이스를 만드는 중 ...완료
pg_authid 초기화 중 ...완료
의존성 정보 초기화 중 ...완료
시스템 뷰들을 만드는 중 ... 완료
시스템 개체들 설명 자료 입력 중 ...완료
collation 만드는 중 ... 완료
인코딩 변환규칙(conversion)들을 만드는 중 ...완료
사전을 만드는 중... 완료
내장개체들의 액세스 권한을 설정 중 ... 완료
information schema 만드는 중 ...완료
서버측 언어인 PL/pgSqL 불러오는 중 ... 완료
template1 데이터베이스 청소 중 ...완료
template1 데이터베이스를 template0 데이터베이스로 복사 중 ...완료
template1 데이터베이스를 postgres 데이터베이스로 복사 중 ...완료
syncing data to disk ... 완료

경고: 로컬 연결의 인증 방법으로 "trust" 방식을 지정했습니다.
이 값을 바꾸려면, pg_hba.conf 파일을 수정하든지,
다음번 initdb 명령을 사용할 때, -A 옵션 또는 --auth-local,
--auth-host 옵션을 사용해서 인증 방법을 지정할 수 있습니다.

작업완료. 이제 다음 명령을 이용해서 서버를 가동 할 수 있습니다:

    /usr/local/bin/pg_ctl -D /usr/local/pgsql/data -l 로그파일 start

root@BSD11:~ #

 

postgresql 실행

git /root > service postgresql start
LOG:  could not create IPv6 socket: Protocol not supported
LOG:  ending log output to stderr
HINT:  Future log output will go to log destination "syslog".
git /root >

 

For PostgreqSQL < 9.6 execute:

blog 내용으로 설치 하였으면 해당 설정을 이용합니다. postgres user 로 설정 해야 합니다.

# create user git
# ATTENTION: for first installation superuser rights are needed; after installation this should be removed!
psql -d template1 -U pgsql -c "CREATE USER git CREATEDB SUPERUSER;"

# Create the GitLab production database & grant all privileges on database
psql -d template1 -U pgsql -c "CREATE DATABASE gitlabhq_production OWNER git;"

# Try connecting to the new database with the new user
psql -U git -d gitlabhq_production

# Connect as superuser to gitlab db and enable pg_trgm extension if not installed
psql -U pgsql -d gitlabhq_production -c "CREATE EXTENSION IF NOT EXISTS pg_trgm;"

 

For PostgreqSQL >= 9.6 execute:

# create user git
psql -d template1 -U postgres -c "CREATE USER git CREATEDB SUPERUSER;"

# Create the GitLab production database & grant all privileges on database
psql -d template1 -U postgres -c "CREATE DATABASE gitlabhq_production OWNER git;"

# Try connecting to the new database with the new user
psql -U git -d gitlabhq_production

# Connect as superuser to gitlab db and enable pg_trgm extension if not installed
psql -U postgres -d gitlabhq_production -c "CREATE EXTENSION IF NOT EXISTS pg_trgm;"

 

PostgreSQL 9.5 command

root@BSD11:~ # psql -d template1 -U pgsql -c "CREATE USER git CREATEDB SUPERUSER;"
CREATE ROLE
root@BSD11:~ # psql -d template1 -U pgsql -c "CREATE DATABASE gitlabhq_production OWNER git;"
CREATE DATABASE
root@BSD11:~ # psql -U git -d gitlabhq_production
gitlabhq_production=# \q
root@BSD11:~ # psql -U pgsql -d gitlabhq_production -c "CREATE EXTENSION IF NOT EXISTS pg_trgm;"
CREATE EXTENSION

 

Redis 설정

root@BSD11:~ # echo 'unixsocket /var/run/redis/redis.sock' >> /usr/local/etc/redis.conf
root@BSD11:~ # echo 'unixsocketperm 770' >> /usr/local/etc/redis.conf
root@BSD11:~ # sysrc redis_enable=YES
redis_enable:  -> YES
root@BSD11:~ # service redis restart
redis not running? (check /var/run/redis/redis.pid).
Starting redis.
root@BSD11:~ # pw groupmod redis -m git

 

GitLab 설정

git 사용자 홈디렉토리를 변경 합니다.

root@BSD11:~ # vipw -d /etc
git:*:211:211::0:0:git user:/usr/local/git:/bin/sh
 
=> /usr/home 으로 변경합니다. 
git:*:211:211::0:0:git user:/usr/home/git:/bin/sh

 

git.yml 파일을 수정 합니다.

root@BSD11:~ # vi /usr/local/www/gitlab-ce/config/gitlab.yml
#    host: localhost
    host: gitlab.example.com 


root@BSD11:/usr/local/www/gitlab-ce # sysctl hw.ncpu
hw.ncpu: 2
root@BSD11:/usr/local/www/gitlab-ce #
root@BSD11:/usr/local/www/gitlab-ce # vi config/unicorn.rb
hw.ncpu 확인시 확인된 cpu 수로 worker 를 설정 2G 이상의 경우 worker default 3개로 사용
worker_processes 3 


root@BSD11:~ # su -l git -c "git config --global core.autocrlf input"
root@BSD11:~ # su -l git -c "git config --global gc.auto 0"
root@BSD11:~ # su -l git -c "git config --global repack.writeBitmaps true"
root@BSD11:~ # su -l git -c "git config --global receive.advertisePushOptions true"
root@BSD11:~ # su -l git -c "mkdir -p /usr/home/git/.ssh"

 

데이터 베이스 초기화 설정

yes 입력시 databasetable 을 생성 합니다.

root@BSD11:~ # chown git /usr/local/share/gitlab-shell
root@BSD11:~ # su -l git -c "cd /usr/local/www/gitlab-ce && rake gitlab:setup RAILS_ENV=production"

Do you want to continue (yes/no)? yes

root@BSD11:~ # chown root /usr/local/share/gitlab-shell

 

password 를 설정 합니다.

test1234

root@BSD11:~ # su -l git -c "cd /usr/local/www/gitlab-ce && rake gitlab:setup RAILS_ENV=production GITLAB_ROOT_PASSWORD=test1234"

 

System infomation 확인

root@BSD11:~ # su -l git -c "cd /usr/local/www/gitlab-ce && rake gitlab:env:info RAILS_ENV=production"

System information
System:
Current User:   git
Using RVM:      no
Ruby Version:   2.4.4p296
Gem Version:    2.7.6
Bundler Version:1.16.2
Rake Version:   12.3.1
Redis Version:  4.0.10
Git Version:    2.18.0
Sidekiq Version:5.1.3
Go Version:     unknown

GitLab information
Version:        11.1.6
Revision:       Unknown
Directory:      /usr/local/www/gitlab-ce
DB Adapter:     postgresql
URL:            http://localhost
HTTP Clone URL: http://localhost/some-group/some-project.git
SSH Clone URL:  git@localhost:some-group/some-project.git
Using LDAP:     no
Using Omniauth: no

GitLab Shell
Version:        7.1.4
Repository storage paths:
- default:      /usr/home/git/repositories
Hooks:          /usr/local/share/gitlab-shell/hooks
Git:            /usr/local/bin/git
root@BSD11:~ #

 

Compile GetText PO files & Compile Assets

root@BSD11:~ # su -l git -c "cd /usr/local/www/gitlab-ce && rake gettext:compile RAILS_ENV=production"
root@BSD11:~ # su -l git -c "cd /usr/local/www/gitlab-ce && rake yarn:install gitlab:assets:clean gitlab:assets:compile RAILS_ENV=production NODE_ENV=production"

 

For PostgreSQL < 9.6 execute:

blog 에서는 PostgreSQL 9.5 를 이용함으로 아래 command 를 입력합니다.

psql -d template1 -U pgsql -c "ALTER USER git WITH NOSUPERUSER;"

 

For PostgreSQL >= 9.6 execute:

psql -d template1 -U postgres -c "ALTER USER git WITH NOSUPERUSER;"

 

PostgreSQL 9.5 command

root@BSD11:~ # psql -d template1 -U pgsql -c "ALTER USER git WITH NOSUPERUSER;"

 

gitlab 데몬 실행

root@BSD11:~ # sysrc gitlab_enable=YES
gitlab_enable:  -> YES

root@BSD11:~ # service gitlab start
Regenerate Gitlab Gemfile.lock
Regenerate Gitaly Gemfile.lock
Starting GitLab Unicorn
Starting GitLab Sidekiq
Starting GitLab Workhorse
Starting Gitaly
master failed to start, check stderr log for details
..
~중략
root@BSD11:~ #

 

Nginx 설치

설치시 아래와 같이 size mismatch 가 발생하면 pkg update -f  로 pkg 를 갱신 합니다. 

root@BSD11:~ # pkg install nginx
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        nginx: 1.14.0_11,2

Number of packages to be installed: 1

The process will require 1 MiB more space.
418 KiB to be downloaded.
[git] [1/1] Fetching nginx-1.14.0_11,2.txz: 100%  418 KiB 428.0kB/s    00:01
pkg: cached package nginx-1.14.0_11,2: size mismatch, fetching from remote
[git] Fetching nginx-1.14.0_11,2.txz: 100%  418 KiB 428.0kB/s    00:01
pkg: cached package nginx-1.14.0_11,2: size mismatch, cannot continue
root@BSD11:~ # pkg update -f

 

Nginx 설치

root@BSD11:~ # pkg install nginx

Message from nginx-1.14.0_11,2:

===================================================================
Recent version of the NGINX introduces dynamic modules support.  In
FreeBSD ports tree this feature was enabled by default with the DSO
knob.  Several vendor's and third-party modules have been converted
to dynamic modules.  Unset the DSO knob builds an NGINX without
dynamic modules support.

To load a module at runtime, include the new `load_module'
directive in the main context, specifying the path to the shared
object file for the module, enclosed in quotation marks.  When you
reload the configuration or restart NGINX, the module is loaded in.
It is possible to specify a path relative to the source directory,
or a full path, please see
https://www.nginx.com/blog/dynamic-modules-nginx-1-9-11/ and
http://nginx.org/en/docs/ngx_core_module.html#load_module for
details.

Default path for the NGINX dynamic modules is

/usr/local/libexec/nginx.
===================================================================

 

Nginx 설정

root@BSD11:~ # vi /usr/local/etc/nginx/nginx.conf


http {
    include       mime.types;
    include       /usr/local/www/gitlab-ce/lib/support/nginx/gitlab;

 

Nginx /etc/rc.conf 에 enable

root@BSD11:~ # sysrc nginx_enable=YES
nginx_enable:  -> YES

 

gitlab 설정변경 및 nginx 실행

root@BSD11:~ # vi /usr/local/www/gitlab-ce/lib/support/nginx/gitlab

  listen 0.0.0.0:80 default_server;
#  listen [::]:80 default_server;

git /root > service nginx stop
Stopping nginx.
Waiting for PIDS: 6103.
git /root >service nginx start
Performing sanity check on nginx configuration:
nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful
Starting nginx.
git /root >


git /root > sockstat -4
USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS         FOREIGN ADDRESS
www      nginx      4460  8  tcp4   10.0.0.1:80           *:*
root     nginx      4459  8  tcp4   10.0.0.1:80           *:*
redis    redis-serv 3675  6  tcp4   10.0.0.1:6379         *:*
pgsql    postgres   3566  8  udp4   10.0.0.1:18280        10.0.0.1:18280
pgsql    postgres   3565  8  udp4   10.0.0.1:18280        10.0.0.1:18280
pgsql    postgres   3564  8  udp4   10.0.0.1:18280        10.0.0.1:18280
pgsql    postgres   3563  8  udp4   10.0.0.1:18280        10.0.0.1:18280
pgsql    postgres   3562  8  udp4   10.0.0.1:18280        10.0.0.1:18280
pgsql    postgres   3560  4  tcp4   10.0.0.1:5432         *:*
pgsql    postgres   3560  8  udp4   10.0.0.1:18280        10.0.0.1:18280
git /root >

 

점검 실행

root@BSD11:~ # su -l git -c "cd /usr/local/www/gitlab-ce && rake gitlab:check RAILS_ENV=production"

 

Web 접속

 

Username : root

password: test1234

 

주의!!! Rebooting 시 gitlab 이 정상적으로 기동이 되지 않습니다.

수동으로 service gitlab start 로 실행 해줘야 합니다.

root@BSD11:~ # service gitlab status
Regenerate Gitlab Gemfile.lock
Regenerate Gitaly Gemfile.lock
The GitLab Unicorn web server with pid 692 is running.
The GitLab Sidekiq job dispatcher is not running.
The GitLab Workhorse is not running.
Gitaly is not running.
root@BSD11:~ # service gitlab start
Regenerate Gitlab Gemfile.lock
Regenerate Gitaly Gemfile.lock
The Unicorn web server already running with pid 692, not restarting.
The Sidekiq job dispatcher is already running with pid 795, not restarting
The GitLab Workhorse is already running with pid 749, not restarting
Gitaly is already running with pid 752, not restarting

The GitLab Unicorn web server with pid 692 is running.
The GitLab Sidekiq job dispatcher with pid 795 is running.
The GitLab Workhorse with pid 749 is running.
Gitaly with pid 752 is running.
GitLab and all its components are up and running.
root@BSD11:~ #

 

 

 

FreeBSD postgresql96-server install

 

FreeBSD Version : 11 

Postgresql Version EOL 확인 https://www.postgresql.org/support/versioning/

 

Port install

root@bsd11:~ # whereis postgresql96-server
postgresql96-server: /usr/ports/databases/postgresql96-server
root@bsd11:~ # cd /usr/ports/databases/postgresql96-server/ && make install clean

 

or

pkg install

root@bsd11:~ # pkg install postgresql96-server postgresql96-client

 

설치완료후 메세지

Installing postgresql96-server-9.6.10...
===> Creating groups.
Creating group 'postgres' with gid '770'.
===> Creating users
Creating user 'postgres' with uid '770'.

  =========== BACKUP YOUR DATA! =============
  As always, backup your data before
  upgrading. If the upgrade leads to a higher
  minor revision (e.g. 8.3.x -> 8.4), a dump
  and restore of all databases is
  required. This is *NOT* done by the port!
  ===========================================
For procedural languages and postgresql functions, please note that
you might have to update them when updating the server.

If you have many tables and many clients running, consider raising
kern.maxfiles using sysctl(8), or reconfigure your kernel
appropriately.

The port is set up to use autovacuum for new databases, but you might
also want to vacuum and perhaps backup your database regularly. There
is a periodic script, /usr/local/etc/periodic/daily/502.pgsql, that
you may find useful. You can use it to backup and perform vacuum on all
databases nightly. Per default, it performs `vacuum analyze'. See the
script for instructions. For autovacuum settings, please review
~pgsql/data/postgresql.conf.

If you plan to access your PostgreSQL server using ODBC, please
consider running the SQL script /usr/local/share/postgresql/odbc.sql
to get the functions required for ODBC compliance.

Please note that if you use the rc script,
/usr/local/etc/rc.d/postgresql, to initialize the database, unicode
(UTF-8) will be used to store character data by default.  Set
postgresql_initdb_flags or use login.conf settings described below to
alter this behaviour. See the start rc script for more info.

To set limits, environment stuff like locale and collation and other
things, you can set up a class in /etc/login.conf before initializing
the database. Add something similar to this to /etc/login.conf:
---
postgres:\
        :lang=en_US.UTF-8:\
        :setenv=LC_COLLATE=C:\
        :tc=default:
---
and run `cap_mkdb /etc/login.conf'.
Then add 'postgresql_class="postgres"' to /etc/rc.conf.

======================================================================

To initialize the database, run

  /usr/local/etc/rc.d/postgresql initdb

You can then start PostgreSQL by running:

  /usr/local/etc/rc.d/postgresql start

For postmaster settings, see ~pgsql/data/postgresql.conf

NB. FreeBSD's PostgreSQL port logs to syslog by default
    See ~pgsql/data/postgresql.conf for more info

NB. If you're not using a checksumming filesystem like ZFS, you might
    wish to enable data checksumming. It can only be enabled during
    the initdb phase, by adding the "--data-checksums" flag to
    the postgres_initdb_flags rcvar.  Check the initdb(1) manpage
    for more info and make sure you understand the performance
    implications.

======================================================================

To run PostgreSQL at startup, add
'postgresql_enable="YES"' to /etc/rc.conf

===> SECURITY REPORT:
      This port has installed the following files which may act as network
      servers and may therefore pose a remote security risk to the system.
/usr/local/bin/postgres

      This port has installed the following startup scripts which may cause
      these network services to be started at boot time.
/usr/local/etc/rc.d/postgresql

      If there are vulnerabilities in these programs there may be a security
      risk to the system. FreeBSD makes no guarantee about the security of
      ports included in the Ports Collection. Please type 'make deinstall'
      to deinstall the port if this is a concern.

      For more information, and contact details about the security
      status of this software, see the following webpage:
https://www.postgresql.org/
===>  Cleaning for gmake-4.2.1_2
===>  Cleaning for gettext-runtime-0.19.8.1_1
===>  Cleaning for libiconv-1.14_11
===>  Cleaning for indexinfo-0.3.1
===>  Cleaning for gettext-tools-0.19.8.1
===>  Cleaning for autoconf-2.69_1
===>  Cleaning for m4-1.4.18,1
===>  Cleaning for texinfo-6.5,1
===>  Cleaning for help2man-1.47.6
===>  Cleaning for p5-Locale-gettext-1.07
===>  Cleaning for perl5-5.26.2
===>  Cleaning for autoconf-wrapper-20131203
===>  Cleaning for automake-1.16.1
===>  Cleaning for icu-62.1_2,1
===>  Cleaning for postgresql96-client-9.6.10
===>  Cleaning for pkgconf-1.4.2,1
===>  Cleaning for readline-7.0.3_1
===>  Cleaning for postgresql96-server-9.6.10
root@bsd11:/usr/ports/databases/postgresql96-server #

 

postgresSQL 설정

root@bsd11:~ # sysrc postgresql_enable=yes
postgresql_enable:  -> yes
root@bsd11:~ #

 

postgres initdb 실행 

root@bsd11:~ # service postgresql initdb
이 데이터베이스 시스템에서 만들어지는 파일들은 그 소유주가 "postgres" id로
지정될 것입니다. 또한 이 사용자는 서버 프로세스의 소유주가 됩니다.

데이터베이스 클러스터는 다음 로케일으로 초기화될 것입니다.
  COLLATE:  C
  CTYPE:    ko_KR.UTF-8
  MESSAGES: ko_KR.UTF-8
  MONETARY: ko_KR.UTF-8
  NUMERIC:  ko_KR.UTF-8
  TIME:     ko_KR.UTF-8
initdb: "ko_KR.UTF-8" 로케일에 알맞은 전문검색 설정을 찾을 수 없음
기본 텍스트 검색 구성이 "simple"(으)로 설정됩니다.

자료 페이지 체크섬 기능 사용 하지 않음

/var/db/postgres/data96 디렉터리 만드는 중 ...완료
하위 디렉터리 만드는 중 ...완료
max_connections 초기값을 선택하는 중 ...100
기본 shared_buffers를 선택하는 중... 128MB
사용할 동적 공유 메모리 관리방식을 선택하는 중 ... posix
환경설정 파일을 만드는 중 ...완료
부트스트랩 스크립트 실행 중 ... 완료
부트스트랩 다음 초기화 작업 중 ... 완료
자료를 디스크에 동기화 하는 중 ... 완료

경고: 로컬 연결의 인증 방법으로 "trust" 방식을 지정했습니다.
이 값을 바꾸려면, pg_hba.conf 파일을 수정하든지,
다음번 initdb 명령을 사용할 때, -A 옵션 또는 --auth-local,
--auth-host 옵션을 사용해서 인증 방법을 지정할 수 있습니다.

작업완료. 이제 다음 명령을 이용해서 서버를 가동 할 수 있습니다:

    /usr/local/bin/pg_ctl -D /var/db/postgres/data96 -l 로그파일 start

root@bsd11:~ #

 

Postgresql 실행

root@bsd11:~ # service postgresql start
로그: stderr 쪽 로그 출력을 중지합니다.
힌트: 자세한 로그는 "syslog" 쪽으로 기록됩니다.
root@bsd11:~ #
root@bsd11:~ # sockstat -4 |grep -i postgre
postgres postgres   839   4  tcp4   *:5432                *:*
root@bsd11:~ #

 

postgresql.conf 수정

root@bsd11:~ # vi /var/db/postgres/data96/postgresql.conf
#listen_addresses = 'localhost'         # what IP address(es) to listen on;
listen_addresses = '*'          # what IP address(es) to listen on;

 

인증 방법 변경 trust -> md5 변경

root@bsd11:~ # cp  /var/db/postgres/data96/pg_hba.conf /var/db/postgres/data96/pg_hba.conf.org
root@bsd11:~ # vi /var/db/postgres/data96/pg_hba.conf

변경전
# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     trust
# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
# IPv6 local connections:
host    all             all             ::1/128                 trust

변경후
# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     trust
# IPv4 local connections:
host    all             all             0.0.0.0/0            md5
# IPv6 local connections:
host    all             all             ::1/128              md5

 

postgres user pass 변경

root@bsd11:~ # passwd postgres
Changing local password for postgres
New Password:
Retype New Password:
root@bsd11:~ #

 

portgres user 로 변경후 작업

root@bsd11:~ # su - postgres
$ psql
psql (9.6.10)
도움말을 보려면 "help"를 입력하십시오.

postgres=# help
PostgreSQL에 대한 명령행 인터페이스인 psql을 사용하고 있습니다.
사용법:  \copyright 저작권 정보
         \h SQL 명령 도움말
         \? psql 명령 도움말
         \g 또는 명령 끝에 세미콜론(;) 쿼리 실행
         \q 종료
postgres=# \q

 

portgresSQL user 생성

$ createuser --interactive
추가할 새 롤(role)이름: db_user
새 롤을 superuser 권한으로 지정할까요? (y/n) n
이 새 롤에게 데이터베이스를 만들 수 있는 권할을 줄까요? (y/n) y
이 새 롤에게 또 다른 롤을 만들 수 있는 권한을 줄까요? (y/n) y
$

 

portgresSQL db 생성

$ createdb new_db

psql 에서 실행

postgres=# ALTER USER db_user WITH ENCRYPTED PASSWORD 'password';
ALTER ROLE

postgres=# GRANT ALL PRIVILEGES ON DATABASE new_db TO db_user;
GRANT

postgres-# \list
                               데이터베이스 목록
   이름    |  소유주  | 인코딩 | Collate |    Ctype    |      액세스 권한
-----------+----------+--------+---------+-------------+-----------------------
 db_user   | postgres | UTF8   | C       | ko_KR.UTF-8 |
 new_db    | postgres | UTF8   | C       | ko_KR.UTF-8 |
 postgres  | postgres | UTF8   | C       | ko_KR.UTF-8 |
 template0 | postgres | UTF8   | C       | ko_KR.UTF-8 | =c/postgres          +
           |          |        |         |             | postgres=CTc/postgres
 template1 | postgres | UTF8   | C       | ko_KR.UTF-8 | =c/postgres          +
           |          |        |         |             | postgres=CTc/postgres
(5개 행)

postgres-#

 

pgAdmin 설치

root@bsd11:~ # python2.7 -m ensurepip
root@bsd11:~ # pkg install py27-virtualenv
root@bsd11:~ # mkdir Workspace
root@bsd11:~ # cd Workspace/
root@bsd11:~/Workspace # virtualenv pgadmin4
New python executable in /root/Workspace/pgadmin4/bin/python2.7
Also creating executable in /root/Workspace/pgadmin4/bin/python
Installing setuptools, pip, wheel...done.
root@bsd11:~/Workspace # cd pgadmin4/bin/
root@bsd11:~/Workspace/pgadmin4/bin # chmod +x activate
root@bsd11:~/Workspace/pgadmin4/bin # ./activate

 

일반유저 작업 test / wheel Group

root@bsd11:~ # su - test

$ python2.7 -m ensurepip
Requirement already satisfied: setuptools in /usr/local/lib/python2.7/site-packages
Requirement already satisfied: pip in /usr/local/lib/python2.7/site-packages
$ virtualenv pgadmin4
New python executable in /usr/home/test/pgadmin4/bin/python2.7
Also creating executable in /usr/home/test/pgadmin4/bin/python
Installing setuptools, pip, wheel...done.
$ . pgadmin4/bin/activate
(pgadmin4) $

프롬프트가 (pgadmin4) $ 바뀌게 됩니다.

 

root user 에서 python dependencie 를 설치 및 pgadmin config 설정

root@bsd11:~ # pip install cryptography pyopenssl ndg-httpsclient pyasn1
root@bsd11:~ # pkg install py27-sqlite3
root@bsd11:~ # wget --no-check-certificate https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v1.5/pip/pgadmin4-1.5-py2.py3-none-any.whl
root@bsd11:~ # pip install pgadmin4-1.5-py2.py3-none-any.whl


root@bsd11:~ # su - test
$ python2.7 /usr/local/lib/python2.7/site-packages/pgadmin4/pgAdmin4.py
NOTE: Configuring authentication for SERVER mode.

Enter the email address and password to use for the initial pgAdmin user account:

Email address: test@test.com
Password:
Retype password:
Starting pgAdmin 4. Please navigate to http://localhost:5050 in your browser.

$ su - 
root@bsd11:~ # vi /usr/local/lib/python2.7/site-packages/pgadmin4/config.py
#DEFAULT_SERVER = 'localhost'
DEFAULT_SERVER = '0.0.0.0'

# The default port on which the app server will listen if not set in the
# environment by the runtime
DEFAULT_SERVER_PORT = 5050

 

일반유저에서 실행

$ python2.7 /usr/local/lib/python2.7/site-packages/pgadmin4/pgAdmin4.py
Starting pgAdmin 4. Please navigate to http://0.0.0.0:5050 in your browser.

 

pgAdmin4.py 실행하여 생성한 유저로 로그인을 합니다. 

 

Docker-compose mkdocs + nginx

별도의 mkdocs container 가 아닌 기본 Nginx 로 mkdocs Test 를 진행 했습니다.

추후 용도에 맞게 php + mysql 등을 설치 하여 사용하기 위하여 docker-compose 를 사용하였습니다.

mkdocs 설치의 경우 포스트를 참고해주세요.

Ubuntu mkdocs 설치

 

Docker-compose 설치

test@docker-test:~/Workspace$ sudo curl -L https://github.com/docker/compose/releases/download/1.19.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
test@docker-test:~/Workspace$ sudo chmod +x /usr/local/bin/docker-compose
test@docker-test:~/Workspace$ docker-compose --version

 

디렉토리 구조 

test@docker-test:~/Workspace/mkdocs$ tree
.
├── docker-compose.yml
├── nginx
│   └── conf
│   └── default.conf
└── wiki

3 directories, 2 files
test@docker-test:~/Workspace/mkdocs$

 

docker-compose.yml 파일 

test@docker-test:~/Workspace/mkdocs$ cat docker-compose.yml
version: '2'

services:
    nginx:
        image: nginx:1.10.2
        ports:
            - 80:80
        restart: always
        volumes:
            - ./nginx/conf:/etc/nginx/conf.d
            - ./wiki/wiki/site:/code

test@docker-test:~/Workspace/mkdocs$

 

nginx/conf/default.conf 파일

test@docker-test:~/Workspace/mkdocs$ cat nginx/conf/default.conf
server {
    listen       80 default_server;
    server_name  localhost _;
    index        index.html index.htm;
    root         /code;

    location / {
        autoindex on;
    }
}

test@docker-test:~/Workspace/mkdocs$

 

mkdocs project 생성

test@docker-test:~/Workspace/mkdocs/wiki$ mkdocs new wiki
INFO - Creating project directory: wiki
INFO - Writing config file: wiki/mkdocs.yml
INFO - Writing initial docs: wiki/docs/index.md
test@docker-test:~/Workspace/mkdocs/wiki$ cd wiki/
test@docker-test:~/Workspace/mkdocs/wiki/wiki$ mkdocs build
INFO - Building documentation to directory: /home/test/Workspace/mkdocs/wiki/wiki/site
test@docker-test:~/Workspace/mkdocs/wiki/wiki$

test@docker-test:~/Workspace/mkdocs$ docker-compose up -d --build
Creating network "mkdocs_default" with the default driver
Creating mkdocs_nginx_1 ... done
test@docker-test:~/Workspace/mkdocs$

 

Ubuntu mkdocs 설치

 

python , python-pip mkdocs 설치

https://www.mkdocs.org Site 에 설치법이 있지만 ubuntu에서 할때는 apt 로 패키지 관리가 좀더 편합니다. 🙂

test@docker-test:~$ sudo apt install python python-pip mkdocs

 

 

mkdocs Test

test@docker-test:~$ mkdocs new my-project
INFO    -  Creating project directory: my-project
INFO    -  Writing config file: my-project/mkdocs.yml
INFO    -  Writing initial docs: my-project/docs/index.md
test@docker-test:~$ cd my-project/
test@docker-test:~/my-project$ mkdocs build

test@docker-test:~/my-project$ mkdocs --help
Usage: mkdocs [OPTIONS] COMMAND [ARGS]...

  MkDocs - Project documentation with Markdown.

Options:
  -V, --version  Show the version and exit.
  -q, --quiet    Silence warnings
  -v, --verbose  Enable verbose output
  -h, --help     Show this message and exit.

Commands:
  build      Build the MkDocs documentation
  gh-deploy  Deploy your documentation to GitHub Pages
  new        Create a new MkDocs project
  serve      Run the builtin development server
test@docker-test:~/my-project$

 

mkdocs serve 로 할때는 일반 유저로도 상관이 없지만 –dev-addr 로 실행할때는 sudo 를 사용해야 합니다.

mkdocs serve 로 Site 를 운영하지 않으며 Github 및 nignx Site 와 연동하여 사용하시면 됩니다. 🙂

test@docker-test:~/my-project$ mkdocs serve
INFO    -  Building documentation...
[I 180909 20:03:45 server:271] Serving on http://127.0.0.1:8000
[I 180909 20:03:45 handlers:58] Start watching changes
^C[I 180909 20:03:46 server:291] Shutting down...
test@docker-test:~/my-project$ sudo mkdocs serve --dev-addr 192.168.101.135:80
INFO    -  Building documentation...
[I 180909 20:03:47 server:271] Serving on http://192.168.101.135:80
[I 180909 20:03:47 handlers:58] Start watching changes
^C[I 180909 20:03:50 server:291] Shutting down...
test@docker-test:~/my-project$

 

 

 

pip upgrade

test@docker-test:~/Workspace/mkdocs$ pip list
pip (8.1.1)
setuptools (20.7.0)
wheel (0.29.0)
You are using pip version 8.1.1, however version 18.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
test@docker-test:~/Workspace/mkdocs$

test@docker-test:~/Workspace/mkdocs$ pip list
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    from pip import main
ImportError: cannot import name main
test@docker-test:~/Workspace/mkdocs$

ssh 재접속후 확인 
test@docker-test:~$ pip list
Package    Version
---------- -------
pip        18.0
setuptools 20.7.0
wheel      0.29.0
test@docker-test:~$

 

 

pip 패키지 설치시 –user 를 사용해야 합니다.

Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/futures-3.2.0.dist-info'
Consider using the `--user` option or check the permissions.

test@docker-test:~/Workspace/mkdocs/wiki/wiki$ pip install mkdocs-rtd-dropdown --user
Successfully installed Jinja2-2.10 Markdown-2.6.11 MarkupSafe-1.0 PyYAML-3.13 backports-abc-0.5 click-6.7 futures-3.2.0 livereload-2.5.2 mkdocs-1.0.4 mkdocs-rtd-dropdown-1.0.2 singledispatch-3.4.0.3 six-1.11.0 tornado-5.1

 

 

pip 패키지 설치후 ssh 재접속을 통하여 정상적인 적용이 가능 합니다. 

pip 패키지 설치후 바로 mkdocs build 시 아래와 같은 메시지를 확인 할수 있습니다.

test@docker-test:~/Workspace/mkdocs/wiki/wiki$ mkdocs build
WARNING -  Config value: 'nav'. Warning: Unrecognised configuration name: nav
ERROR   -  Config value: 'theme'. Error: Unrecognised theme.

Aborted with 1 Configuration Errors!
test@docker-test:~/Workspace/mkdocs/wiki/wiki$

 

 

ssh 재접속후 mkdocs build

test@docker-test:~/Workspace/mkdocs/wiki/wiki$ mkdocs build
INFO    -  Cleaning site directory
INFO    -  Building documentation to directory: /home/test/Workspace/mkdocs/wiki/wiki/site
test@docker-test:~/Workspace/mkdocs/wiki/wiki$

 

 

material theme 사용시

site : https://squidfunk.github.io/mkdocs-material/

$ vi mkdocs.yml
theme:
name: 'material'
language: 'kr'

$ pip install mkdocs-material --user
$ mkdocs build

 

 

 

 

FreeBSD Test Version 11.02

014XY 같은 BBS를 찾다 보니 Telnet 기반의 BBS Server 가 있어서 테스트 삼아 설치를 진행해 봤습니다.

단순한 설치 / telnet 접속 까지만 진행하며 그외 설정 파일을 구글링을 통하여 설정해 보시기 바랍니다.

Synchronet 은 ports 로 제공되지 않습니다. wget 으로 Source 를 받아 와야 하며

의존성 패키지의 경우 pkg install 로 설치를 진행 하였습니다.

참고 site : http://www.synchro.net/    http://wiki.synchro.net/install:nix

 

 

의존성 패키지 설치

root@BSD11-Test:~ # pkg install wget cryptlib gmake gcc nspr python pkgconf unzip zip cvs spidermonkey17 perl5

 

Synchronet 디렉토리 생성

root@BSD11-Test:~ # mkdir /usr/local/etc/sbbs
root@BSD11-Test:~ # cd /usr/local/etc/sbbs/

 

Synchronet 설치

root@BSD11-Test:/usr/local/etc/sbbs # wget ftp://vert.synchro.net/Synchronet/sbbs_src.tgz
root@BSD11-Test:/usr/local/etc/sbbs # wget ftp://vert.synchro.net/Synchronet/sbbs_run.tgz
root@BSD11-Test:/usr/local/etc/sbbs # tar -xzf sbbs_src.tgz && tar -xzf sbbs_run.tgz
root@BSD11-Test:/usr/local/etc/sbbs # cd src/sbbs3; gmake RELEASE=1
~중략
Compiling ../sbbs_ini.c
Compiling ../scfglib1.c
Compiling ../scfglib2.c
Compiling spyon.c
Compiling ../str_util.c
Compiling umonitor.c
Compiling ../userdat.c
Linking clang.freebsd.amd64.exe.release/umonitor
gmake[1]: Leaving directory '/usr/local/etc/sbbs/src/sbbs3/umonitor'
root@BSD11-Test:/usr/local/etc/sbbs/src/sbbs3 # cd /usr/local/etc/sbbs/xtrn/sbj; gmake
~중략
./sbj.c:94:11: note: expanded from macro 'A'
#define A 14    /* ace */
          ^
52 warnings generated.
root@BSD11-Test:/usr/local/etc/sbbs/xtrn/sbj # cd /usr/local/etc/sbbs/xtrn/sbl; gmake
~중략
65 warnings generated.
Linking clang.freebsd.amd64.exe.debug/smb2sbl
Compiling sblpack.c
Linking clang.freebsd.amd64.exe.debug/sblpack
root@BSD11-Test:/usr/local/etc/sbbs/xtrn/sbl #
root@BSD11-Test:/usr/local/etc/sbbs/xtrn/sbl # cd /usr/local/etc/sbbs/src/sbbs3/umonitor; gmake
root@BSD11-Test:/usr/local/etc/sbbs/src/sbbs3/umonitor # cd /usr/local/etc/sbbs/src/sbbs3/umonitor
root@BSD11-Test:/usr/local/etc/sbbs/src/sbbs3/umonitor # cp clang.freebsd.amd64.exe.debug/* /usr/local/etc/sbbs/exec/
root@BSD11-Test:/usr/local/etc/sbbs/src/sbbs3/umonitor # cd /usr/local/etc/sbbs/src/sbbs3/uedit; gmake
~중략
Compiling ../str_util.c
Compiling uedit.c
Compiling ../userdat.c
Linking clang.freebsd.amd64.exe.debug/uedit
root@BSD11-Test:/usr/local/etc/sbbs/src/sbbs3/uedit #
root@BSD11-Test:/usr/local/etc/sbbs/src/sbbs3/uedit # cp clang.freebsd.amd64.exe.debug/* /usr/local/etc/sbbs/exec/
root@BSD11-Test:/usr/local/etc/sbbs/src/sbbs3/uedit # cd /usr/local/etc/sbbs/src/sbbs3/syncview; gmake
~중략
gmake[1]: Entering directory '/usr/local/etc/sbbs/src/conio'
gmake[1]: Nothing to be done for 'mtlib'.
gmake[1]: Leaving directory '/usr/local/etc/sbbs/src/conio'
Compiling syncview.c
Linking clang.freebsd.amd64.exe.debug/syncview
root@BSD11-Test:/usr/local/etc/sbbs/src/sbbs3/syncview #
root@BSD11-Test:/usr/local/etc/sbbs/src/sbbs3/syncview # cp clang.freebsd.amd64.exe.debug/* /usr/local/etc/sbbs/exec/
root@BSD11-Test:/usr/local/etc/sbbs/exec # ln -s ../src/sbbs3/clang.freebsd.amd64.exe.release/* .
root@BSD11-Test:/usr/local/etc/sbbs/exec # ln -s ../src/sbbs3/scfg/clang.freebsd.amd64.exe.release/scfg* .
root@BSD11-Test:/usr/local/etc/sbbs/exec # gmake
~중략
BAJA v2.34-FreeBSD (rev 1.50) - Synchronet Shell/Module Compiler

Compiling yesnobar.src...
Resolving labels...

Done.
root@BSD11-Test:/usr/local/etc/sbbs/exec #

 

.cshrc 환경변수 추가

root@BSD11-Test:~ # vi .cshrc
# set path /usr/local/etc/sbbs/exec 추가 
set path = (/sbin /bin /usr/sbin /usr/bin /usr/local/sbin /usr/local/bin /usr/local/etc/sbbs/exec $HOME/bin)

setenv  EDITOR  vi
setenv  PAGER   more
setenv  BLOCKSIZE       K
# setenv 라인 추가 
setenv SBBSCTRL /usr/local/etc/sbbs/ctrl
root@BSD11-Test:~ # source .cshrc

 

실행 스크립트 /etc/rc.d 디렉토리에 설정

root@BSD11-Test:~ # cd /etc/rc.d/
root@BSD11-Test:/etc/rc.d # wget 'http://cvs.synchro.net/cgi-bin/viewcvs.cgi/*checkout*/install/rc.d/sbbs'
root@BSD11-Test:/etc/rc.d # chmod 555 sbbs

 

/etc/rc.conf 수정

root@BSD11-Test:~ # vi /etc/rc.conf

sbbs_dir="/usr/local/etc/sbbs"
sbbs_enable="YES"

 

콘솔에서 scfg 실행 / Synchronet 기본 설정을 진행 합니다.

(주의!!! ssh 및 telnet 환경에서는 정상적으로 실행 되지 않습니다.)

 

System -> Sysop (Admin) password 를 설정 합니다.

ESC 를 눌러 설정을 저장 합니다.

 

putty 접속시 Telnet 으로 접속을 합니다.

 

New 를 입력하여 신규 유저를 생성합니다.

 

User 를 생성 합니다.

 

 

 

 

 

1: Synchronet (Classic) 선택

 

user01 의 password 를 설정 합니다.

 

 

 

 

 

 

User 생성이 마무리 되었습니다.

추가적인 설정은 구글링을 통하여 설정 하시기 바랍니다.  🙂

 

 

 

docker-compose WiKi.js

참고페이지: https://docs.requarks.io/wiki/install/docker#using-docker-compose

 

wiki 디렉토리 생성 및 docker-compose.yml 파일생성

test@docker-test:~/Workspace$ mkdir wiki 
test@docker-test:~/Workspace/wiki$ vi docker-compose.yml
version: "3"
services:

  db:
    image: postgres:11-alpine
    environment:
      POSTGRES_DB: wiki
      POSTGRES_PASSWORD: wikijsrocks
      POSTGRES_USER: wikijs
    logging:
      driver: "none"
    restart: unless-stopped
    volumes:
      - db-data:/var/lib/postgresql/data

  wiki:
    image: requarks/wiki:2
    depends_on:
      - db
    environment:
      DB_TYPE: postgres
      DB_HOST: db
      DB_PORT: 5432
      DB_USER: wikijs
      DB_PASS: wikijsrocks
      DB_NAME: wiki
    restart: unless-stopped
    ports:
      - "80:3000"

volumes:
  db-data:

 

wikijs config.yml 파일 생성

sample 파일 : https://docs.requarks.io/install/docker

수정할 부분은 아래 내용참고

test@docker-test:~/Workspace/wiki$ vi config.yml

host: http://192.168.0.100

port: 3000

test@docker-test:~/Workspace/wiki$ docker-compose up -d --build
test@docker-test:~/Workspace/wiki$ docker ps
CONTAINER ID        IMAGE                COMMAND                  CREATED             STATUS              PORTS                            NAMES
2178f46ab155        requarks/wiki:2      "docker-entrypoint.s…"   56 minutes ago      Up 56 minutes       3443/tcp, 0.0.0.0:80->3000/tcp   wiki_wiki_1
56a292756816        postgres:11-alpine   "docker-entrypoint.s…"   56 minutes ago      Up 56 minutes       5432/tcp                         wiki_db_1