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

 

 

 

 

 

ubuntu WiKi.js install

 

Git install

test@docker-test:~$ sudo add-apt-repository -y ppa:git-core/ppa
test@docker-test:~$ sudo apt update && sudo apt upgrade
test@docker-test:~$ sudo apt install git

 

Nodejs install

test@docker-test:~$ sudo apt install curl
test@docker-test:~$ curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
test@docker-test:~$ sudo apt install -y nodejs
test@docker-test:~$ sudo apt install mongodb

 

Wiki-js install

test@docker-test:~$ sudo mkdir -p /var/www/wikijs
test@docker-test:~$ cd /var/www/wikijs/
test@docker-test:/var/www/wikijs$ curl -sSo- https://wiki.js.org/install.sh | sudo bash
 __    __ _ _    _    _
/ / /\ \ (_) | _(_)  (_)___
\ \/  \/ / | |/ / |  | / __|
 \  /\  /| |   <| |_ | \__ \
  \/  \/ |_|_|\_\_(_)/ |___/
                   |__/
   < INSTALL >

[1/3] Fetching latest build...
[2/3] Fetching dependencies...
[3/3] Creating config file...
-> Installation Complete

Thank you for installing Wiki.js!
Please consider donating to our open collective to help maintain this project:
https://opencollective.com/wikijs/donate

- Launch configuration wizard: node wiki configure
- Start Wiki.js server: node wiki start

test@docker-test:/var/www/wikijs$

test@docker-test:/var/www/wikijs$ sudo node wiki configure

 

 

 

 

 

 

 

 

SKIP THIS STEP 으로 Git 설정 부분은 넘어갑니다.

 

 

 

 

Configure 가 끝나면 자동적으로 wiki js 가 정지 합니다.

test@docker-test:/var/www/wikijs$ sudo node wiki configure
⠴ Browse to http://localhost:3000 to configure Wiki.js!
✔ Wiki.js is now running in normal mode!
test@docker-test:/var/www/wikijs$

 

WiKi.js config 파일 수정및 WiKi.js 실행

test@docker-test:/var/www/wikijs$ pwd
/var/www/wikijs
test@docker-test:/var/www/wikijs$ vi config.yml
title: Wiki
#host: 'http://localhost'
host: 'http://192.168.0.100'
port: 80
test@docker-test:/var/www/wikijs$ sudo node wiki start
✔ Wiki.js has started successfully.
test@docker-test:/var/www/wikijs$

 

 

 

 

ubuntu upgrade 16.04 -> 18.04

 

/etc/lsb-release 확인

login as: test
test@192.168.0.10's password:
Welcome to Ubuntu 16.04.2 LTS (GNU/Linux 4.4.0-62-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

206 packages can be updated.
114 updates are security updates.

New release '18.04.1 LTS' available.
Run 'do-release-upgrade' to upgrade to it.


Last login: Mon Sep  3 14:59:41 2018
test@docker-test:~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.2 LTS"

 

16.04 모든 패키지 업데이트

test@docker-test:~$ sudo apt update && sudo apt dist-upgrade && sudo apt autoremove

 

update-manager-core 패키지 설치

test@docker-test:~$ sudo apt-get install update-manager-core

 

Prompt=lts 확인

test@docker-test:~$ cat /etc/update-manager/release-upgrades |grep -i prompt
# Default prompting behavior, valid options:
Prompt=lts
test@docker-test:~$

 

18.04 upgrade

test@docker-test:~$ sudo do-release-upgrade -d

Reading cache

Checking package manager

Continue running under SSH?

This session appears to be running under ssh. It is not recommended
to perform a upgrade over ssh currently because in case of failure it
is harder to recover.

If you continue, an additional ssh daemon will be started at port
'1022'.
Do you want to continue?

Continue [yN] y

To make recovery in case of failure easier, an additional sshd will
be started on port '1022'. If anything goes wrong with the running
ssh you can still connect to the additional one.
If you run a firewall, you may need to temporarily open this port. As
this is potentially dangerous it's not done automatically. You can
open the port with e.g.:
'iptables -I INPUT -p tcp --dport 1022 -j ACCEPT'

To continue please press [ENTER]

 

keep the local version currently installed 을 선택 합니다.

 

System Rebooting 후 lsb-release 확인시 18.04 로 update 된것을 확인할수 있습니다.

To finish the upgrade, a restart is required.
If you select 'y' the system will be restarted.

Continue [yN] y

test@docker-test:~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.1 LTS"
test@docker-test:~$

 

FreeBSD mkdocs 설치

mkdocs 소개 

MkDocs is a fast, simple and downright gorgeous static site generator that’s geared towards building project documentation. Documentation source files are written in Markdown, and configured with a single YAML configuration file.

참고페이지 : https://demun.github.io/mkdocs-tuts/#mkdocs
   : https://www.mkdocs.org/#installation
official site : https://www.mkdocs.org/

사용법참고: https://demun.github.io/mkdocs-tuts/how/

 

mkdocs 설치

root@bsd11:~ # whereis py-mkdocs
py-mkdocs: /usr/ports/textproc/py-mkdocs
root@bsd11:~ #
root@bsd11:~ # cd /usr/ports/textproc/py-mkdocs && make install clean
Installing py27-mkdocs-1.0...
If you are using the Python v3.x version and a non-Unicode locale you'll get a r untime error when mkdocs is executed..
In that case please set the locale to a Unicode locale first, e.g. en_US.UTF-8 o r similar, before starting mkdocs.
~중략
root@bsd11:/usr/ports/textproc/py-mkdocs # rehash

 

mkdocs 사용

default 사용시 127.0.0.18000 로 open 됩니다.

root@bsd11:~ # mkdocs new mkdocs-tuts
INFO - Creating project directory: mkdocs-tuts
INFO - Writing config file: mkdocs-tuts/mkdocs.yml
INFO - Writing initial docs: mkdocs-tuts/docs/index.md
root@bsd11:~ # cd mkdocs-tuts

mkdocs serve 실행시 locale:8000 로 실행 됩니다. 
root@bsd11:~/mkdocs-tuts # mkdocs serve
INFO - Building documentation...
INFO - Cleaning site directory
[I 180903 22:39:37 server:292] Serving on http://127.0.0.1:8000
[I 180903 22:39:37 handlers:59] Start watching changes
[I 180903 22:39:37 handlers:61] Start detecting changes

 

–dev-addr 옵션 사용시 IP:port 를 지정할수 있습니다.

root@bsd11:~/mkdocs-tuts # mkdocs serve --dev-addr 192.168.0.100:80
INFO - Building documentation...
INFO - Cleaning site directory
[I 180903 22:44:20 server:292] Serving on http://192.168.0.100:80
[I 180903 22:44:20 handlers:59] Start watching changes
[I 180903 22:44:20 handlers:61] Start detecting changes
[I 180903 22:44:26 handlers:132] Browser Connected: http://192.168.0.100/
[I 180903 22:48:21 handlers:132] Browser Connected: http://192.168.0.100/#welcome-to-mkdocs
[I 180903 22:48:23 handlers:132] Browser Connected: http://192.168.0.100/


Port 확인
root@bsd11:~ # sockstat -4
USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS
root python2.7 6008 3 tcp4 175.211.33.9:80 *:*
root python2.7 6008 7 tcp4 175.211.33.9:80 192.168.0.10:8713
root python2.7 6008 8 tcp4 175.211.33.9:80 192.168.0.10:8718
root python2.7 6008 9 tcp4 175.211.33.9:80 192.168.0.10:8714
root python2.7 6008 10 tcp4 175.211.33.9:80 192.168.0.10:8715
root python2.7 6008 13 tcp4 175.211.33.9:80 192.168.0.10:8716
root python2.7 6008 15 tcp4 175.211.33.9:80 192.168.0.10:8717
test sshd 5978 3 tcp4 175.211.33.9:22 192.168.0.10:8685
root sshd 5975 3 tcp4 175.211.33.9:22 192.168.0.10:8685
test sshd 755 3 tcp4 175.211.33.9:22 192.168.0.10:8627
root sshd 752 3 tcp4 175.211.33.9:22 192.168.0.10:8627
root sendmail 682 3 tcp4 127.0.0.1:25 *:*
root sshd 679 4 tcp4 *:22 *:*

 

website 접속

Nginx 와 MKdocs 사용예

FreeBSD Nginx 설치는 아래 내용을 참고 하시면 됩니다.

[web-server] Nginx 설치

mkdocs serve 를 통하여 사용하지 않고 nginx or apache 로 구성된 웹서버에서 사용하시면 됩니다.

ex) /var/www/test.com 으로 구성된 nginx home 디렉토리에서 mkdocs-tuts 프로젝트를 만들고

build 까지 한후 web에서 접속한 예제 입니다.

root@bsd11:/var/www/test.com # mkdocs new mkdocs-tuts
INFO    -  Creating project directory: mkdocs-tuts
INFO    -  Writing config file: mkdocs-tuts/mkdocs.yml
INFO    -  Writing initial docs: mkdocs-tuts/docs/index.md
root@bsd11:/var/www/test.com #


root@bsd11:/var/www/test.com # cd mkdocs-tuts/
root@bsd11:/var/www/test.com/mkdocs-tuts # ll
total 1
drwxr-xr-x  2 root  www   3  9  5 01:02 docs/
-rw-r--r--  1 root  www  19  9  5 01:02 mkdocs.yml
root@bsd11:/var/www/test.com/mkdocs-tuts #


root@bsd11:/var/www/test.com/mkdocs-tuts # mkdocs build
INFO    -  Cleaning site directory
INFO    -  Building documentation to directory: /var/www/test.com/mkdocs-tuts/site
root@bsd11:/var/www/test.com/mkdocs-tuts #

 

접속확인

 

Theme 변경

root@bsd11:/var/www/test.com/mkdocs-tuts # vi mkdocs.yml
site_name: My Docs
theme: readthedocs

root@bsd11:/var/www/test.com/mkdocs-tuts # mkdocs build
INFO - Cleaning site directory
INFO - Building documentation to directory: /var/www/test.com/mkdocs-tuts/site
root@bsd11:/var/www/test.com/mkdocs-tuts #

 

 

dropdown 적용

참고페이지: https://github.com/cjsheets/mkdocs-rtd-dropdown

설치 

test@docker-test:~$ pip install mkdocs-rtd-dropdown

 

http://readthedocs.sheets.ch/#installation

root@bsd11:/var/www/test.com/mkdocs-tuts # cat mkdocs.yml
site_name: Opensource manual
#theme: readthedocs
theme: rtd-dropdown
nav:
  - INFO: index.md
  - Reference:
      Linux: linux/linux.md
      Cloud: cloud/cloud.md
      Languge: lang/lang.md
      FreeBSD: freebsd/freebsd.md

root@bsd11:/var/www/test.com/mkdocs-tuts # tree
.
├── docs
│&nbsp;&nbsp; ├── cloud
│&nbsp;&nbsp; │&nbsp;&nbsp; └── cloud.md
│&nbsp;&nbsp; ├── freebsd
│&nbsp;&nbsp; │&nbsp;&nbsp; └── freebsd.md
│&nbsp;&nbsp; ├── index.md
│&nbsp;&nbsp; ├── lang
│&nbsp;&nbsp; │&nbsp;&nbsp; └── lang.md
│&nbsp;&nbsp; └── linux
│&nbsp;&nbsp;     └── linux.md
├── mkdocs.yml
└── site
    ├── 404.html
    ├── centos
    │&nbsp;&nbsp; └── centos
    │&nbsp;&nbsp;     └── index.html
    ├── cloud
    │&nbsp;&nbsp; └── cloud
    │&nbsp;&nbsp;     └── index.html
    ├── css
    │&nbsp;&nbsp; ├── theme_extra.css
    │&nbsp;&nbsp; └── theme.css
    ├── fonts
    │&nbsp;&nbsp; ├── fontawesome-webfont.eot
    │&nbsp;&nbsp; ├── fontawesome-webfont.svg
    │&nbsp;&nbsp; ├── fontawesome-webfont.ttf
    │&nbsp;&nbsp; └── fontawesome-webfont.woff
    ├── freebsd
    │&nbsp;&nbsp; └── freebsd
    │&nbsp;&nbsp;     └── index.html
    ├── how
    │&nbsp;&nbsp; └── index.html
    ├── img
    │&nbsp;&nbsp; └── favicon.ico
    ├── index.html
    ├── js
    │&nbsp;&nbsp; ├── jquery-2.1.1.min.js
    │&nbsp;&nbsp; ├── modernizr-2.8.3.min.js
    │&nbsp;&nbsp; └── theme.js
    ├── lang
    │&nbsp;&nbsp; └── lang
    │&nbsp;&nbsp;     └── index.html
    ├── linux
    │&nbsp;&nbsp; └── linux
    │&nbsp;&nbsp;     └── index.html
    ├── search
    │&nbsp;&nbsp; ├── lunr.js
    │&nbsp;&nbsp; ├── main.js
    │&nbsp;&nbsp; ├── search_index.json
    │&nbsp;&nbsp; └── worker.js
    ├── search.html
    ├── sitemap.xml
    ├── sitemap.xml.gz
    └── ubuntu
        └── ubuntu
            └── index.html

24 directories, 32 files
root@bsd11:/var/www/test.com/mkdocs-tuts #
root@bsd11:/var/www/test.com/mkdocs-tuts # cat docs/linux/linux.md
## CentOS

## Ubuntu

### System Command

### Package install
root@bsd11:/var/www/test.com/mkdocs-tuts #