systemd 는 이제 리눅스 시스템의 뼈대가 되는 기본운영 방법이 되었다. 기존에는 System V Init 이였지만 RHEL 7, Ubuntu 16.04부터 기본 시스템운영 프로그램이 되었다. systemd 는 ‘ctl’ 로 끝나는 명령어들의 집합으로 제어가 가능하다. systemctl, journalctl, timedatectl, hostnamectl, loginctl 이 대표적이다. systemctl 의 경우에는 systemd unit 파일들에 대한 제어와 설정이 가능하다. systemd unit 파일은 기존의 Systemv V init Script 를 대체하는 것으로 일종의 시스템 데몬 프로그램들이라고 보면 된다. 시스템이 시작될때에 자동으로 시작되게 한다거나 종료하게 한다거나 하는것들을 가능하게 한다. unit 파일은 텍스트 파일이기 […]
Redmine 컴파일 설치
Redmine 컴파일 설치에 대해서 다룬다. 최신의 OS 를 가지고 하면 좋겠지만, CentOS 7 에서 설치를 진행 했다. Mariadb 설치 MySQL 도 가능하지만, MariaDB 를 선택했다. 컴파일 설치가 가능하지만 패키지 설치로 설치한다.
1 |
]# yum install mariadb-server mariadb-devel -y |
각종 의존성이 함께 설치가 된다. CentOS 7 에서 MariaDB 버전은 5.5 이다. 현재 최선 버전은 10.4 이며 이것을 설치하고자 한다면 MariaDB 홈페이지에 공식 리파지토리를 설정하고 yum 명령어로 간단하게 설치할 수 있다. my.cnf 파일을 다음과 같이 설정해 준다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
]# vim /etc/my.cnf [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 # Settings user and group are ignored when systemd is used. # If you need to run mysqld under a different user or group, # customize your systemd unit file for mariadb according to the # instructions in http://fedoraproject.org/wiki/Systemd character-set-server = utf8 collation-server = utf8_general_ci port = 3306 skip-name-resolve [mysqld_safe] log-error=/var/log/mariadb/mariadb.log pid-file=/var/run/mariadb/mariadb.pid # # include all files from the config directory # !includedir /etc/my.cnf.d [mysql] default-character-set = utf8 no-auto-rehash show-warnings prompt=\u@\h:\d\_\R:\m:\\s> pager="less -n -i -F -X -E" |
캐릭터 셋을(character-set) 설정하는 부분과 함께 mysql 콘솔에 대한 설정이 전부다. […]
Redmine 설치하기
Redmine 은 오픈소스 프로젝트 매니지먼트 프로그램이다. Ruby 로 제작되었기 때문에 설치 과정에서 Ruby 가 있어야 한다. 웹을 통해서 서비스를 하기 때문에 보통 웹서버와 연동을 하는 편이다. 환경 OS: CentOS 7 Arch: x86_64 Minimal Installation 상태 MariaDB 설치 MySQL 도 가능하지만, MariaDB 를 선택했다. 컴파일 설치가 가능하지만 패키지 설치로 설치한다.
1 |
]# yum install mariadb-server -y |
각종 의존성이 함께 설치가 된다. my.cnf 파일을 다음과 같이 설정해 준다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
]# vim /etc/my.cnf [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 # Settings user and group are ignored when systemd is used. # If you need to run mysqld under a different user or group, # customize your systemd unit file for mariadb according to the # instructions in http://fedoraproject.org/wiki/Systemd character-set-server = utf8 collation-server = utf8_general_ci port = 3306 skip-name-resolve [mysqld_safe] log-error=/var/log/mariadb/mariadb.log pid-file=/var/run/mariadb/mariadb.pid # # include all files from the config directory # !includedir /etc/my.cnf.d [mysql] default-character-set = utf8 no-auto-rehash show-warnings prompt=\u@\h:\d\_\R:\m:\\s> pager="less -n -i -F -X -E" |
다음과 같이 서버를 실행해 준다.
1 2 |
]# systemctl start mariadb.service ]# systemctl enable mariadb.service |
이제 기본적인 설정을 위해 mysql_secure_installation 을 실행해 준다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
]# mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): <- 그냥 엔터 OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation. Set root password? [Y/n] Y New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success! By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] Y ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] Y ... Success! By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] Y - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] Y ... Success! Cleaning up... All done! If you've completed all of the above steps, your MariaDB installation should now be secure. Thanks for using MariaDB! ]# |
root 패스워드를 설정하기 […]
Yum 패키지 충돌 발생시 쓸 수 있는 명령어
최근에 CentOS 8 에서 Kubernetes 를 테스트하던 중에 패키지 업데이트가 되지 않는 일이 발생 했다. 아직 Kubernetes 는 CentOS 8 배포판을 정식으로 지원하지 않아 CentOS 7 배포판의 패키지를 사용해야 하는 상황이다. 그런데, yum 명령어로 업데이트를 할려고 보니 오류가 발생 했다. 이럴 경우에 다음과 같은 명령어를 사용해서 의존성을 체크해 볼 수 있다.
1 2 3 4 5 6 7 8 9 10 11 12 |
# repoquery --requires --resolve kubelet-1.18 ethtool-2:4.8-10.el7.x86_64 iptables-0:1.4.21-34.el7.x86_64 util-linux-0:2.23.2-63.el7.x86_64 iptables-0:1.4.21-34.el7.i686 util-linux-0:2.23.2-63.el7.i686 conntrack-tools-0:1.4.4-7.el7.x86_64 iproute-0:4.11.0-25.el7_7.2.x86_64 ebtables-0:2.0.10-16.el7.x86_64 glibc-0:2.17-307.el7.1.i686 glibc-0:2.17-307.el7.1.x86_64 socat-0:1.7.3.2-2.el7.x86_64 |
위와같은 명령어를 이용하면 패키지 의존성에 대한 내용을 풀어서 볼 수 있다. 참고: kubeadm and kubelet 1.15 fail to install on centos 7 after patches released today#92242
Generic WebHook Trigger 설정
Jenkins 에서 Github 나 GitLab 와 연동하기 위해서 Generic WebHook Trigger 플러그인을 많이 사용한다. 검색을 해보면 사용법이 아주 많이 나오는데, 특정 브랜치(Branch) 에만 작동되게 하기 위해서 Execute Shell 를 활용하는 사례를 볼 수 있다. 하지만 Generic WebHook Trigger 플러그인 설정에서 그냥 특정 브랜치만 반응하도록 할 수 있다. 제일 먼저 Post content parameters 에서 Variable 에 “ref”, Expression 에는 “$.ref” 를 적어주고 JSONPath 를 선택해 준다. 이것은 Github나 GitLab 가 jenkins 를 호출할때에 JSON 포맷으로 관련 데이터를 넘겨주게 된다. JSON 포맷이기 […]
letsencrypt 인증서 발급/갱신
letencrypt 는 무료로 발급 받을 수 있는 도메인 인증서이다. 도메인 인증서는 서버와 클라이언트간에 HTTP 통신을 암호화하는데 필요한 것이다. 원래는 돈을 주고 구매해야 하지만 letsencrypt 는 무료로 사용할 수 있게 해준다. 대부분의 발급 절차를 서버의 CLI 를 통해서 이루어진다. 따라서 서버가 있어야 하며 터미널 접속이 가능해야 한다. 또, Python 을 필요로 한다. 인증서를 발급 받기위해서 프로그램을 사용하는데 이것이 Python 을 필요로 한다. certbot 설치 certbot 은 letsencrypt 인증서를 발급받기 위한 CLI 명령어 세트다. 다음과 같이 다운로드 할 수 있다.
1 2 3 |
]$ git clone https://github.com/letsencrypt/letsencrypt ]$ ls letsencrypt |
복제된 […]
VIM, Yaml 문법 적용
이 문서는 VIM, Yaml 문법 적용에 관한 것이다. YAML 은 각종 설정파일에서 자주 쓰인다. Kubernetes 에서는 manifest 파일로 쓰이고 있는데, VIM 을 이용해 Yaml 을 편집할때에 간단하게 사용할 수 있는 방법을 소개한다. 간단하게 .vimrc 파일에 다음과 같이 입력해주면 된다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
syntax on set nocompatible set hls set scs set visualbell set ignorecase set showmatch set fileencodings=utf-8 set termencoding=utf-8 set encoding=utf-8 " add yaml stuffs " au! BufNewFile,BufReadPost *.{yaml,yml} set filetype=yaml foldmethod=indent au! BufNewFile,BufReadPost *.{yaml,yml} set filetype=yaml autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab autoindent |
내용을 보면 금방 이해가 될 것이다.
GitLab 설치와 설정
GitLab 설치 하기. GitLab 은 무료로 사용가능한 git 저장소, ticket 시스템이다. github 의 오픈소스 버전으로 생각할 수 있지만 그것보다 많은 기능을 제공한다. 이 글에서는 gitlab 을 Ubuntu 20.04 LTS 에 설치와 설정에 대해서 알아보도록 하겠다. 준비 Gitlab 을 설치하기 전에 필요한 의존성 패키지들을 먼저 설치해 준다.
1 |
]$ sudo apt install -y ca-certificates curl |
메일을 사용할 경우에는 메일 서버를 설치해줘야 하지만 여기서는 제외한다. Gitlab 설치를 위한 저장소 추가 gitlab 홈페이지에서는 각 리눅스 배포판에 맞춰 스크립트를 제공한다. Ubuntu 20.04 를 위해 제공해주는 스크립트를 실행해 준다.
1 |
]$ sudo curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash |
Gitlab 설치 […]
virsh 를 통해 Ubuntu 20.04 에 console 로 접속하는 방법
KVM 가상화 시스템에서 virsh 를 통해 Ubuntu Guest OS에 Console 로 접속하는 방법은 다양한데 대부분 grub 부팅 옵션을 손보는 것이 였다. 하지만 Ubuntu 20.04 로 넘어오면서 이 방법이 훨씬 간단해 졌다. 먼저 Ubuntu 20.04 Guest 에 접속한 후에 다음과 같이 입력 하면 끝난다.
1 2 |
$ sudo systemctl enable serial-getty@ttyS0.service $ sudo systemctl start serial-getty@ttyS0.service |
이렇게 한 후에 KVM 시스템에서 console 접속을 하면 접속이 잘된다.
1 2 3 4 5 |
$ virsh console ubuntu20.04 Connected to domain ubuntu20.04 Escape character is ^] systemv login: |
이 방법은 18.04 에서도 가능하다.
VSCode 폰트 변경하기
VSCode 폰트(font) 변경하기에 대해서 알아본다. 환경도 윈도우즈가 아닌 리눅스(Linux) 에서 VSCode 폰트 변경이다. 리눅스 환경에서 폰트변경은 뭐든 쉬운 일이 아니다. 폰트(font) 알기 – fc-list 리눅스에서 폰트는 fc-list 명령어를 통해서 알 수 있다.
1 2 3 4 5 6 7 8 |
$ fc-list /usr/share/fonts/truetype/tlwg/TlwgTypo-Bold.ttf: Tlwg Typo:style=Bold /usr/share/fonts/truetype/dejavu/DejaVuSerif-Bold.ttf: DejaVu Serif:style=Bold /usr/share/fonts/truetype/noto/NotoSansThai-Regular.ttf: Noto Sans Thai:style=Regular /usr/share/fonts/truetype/noto/NotoSansModi-Regular.ttf: Noto Sans Modi:style=Regular /usr/share/fonts/opentype/urw-base35/URWBookman-LightItalic.otf: URW Bookman:style=Light Italic /usr/share/fonts/truetype/fonts-kalapi/Kalapi.ttf: Kalapi:style=Regular /usr/share/fonts/truetype/fonts-gujr-extra/Rekha.ttf: Rekha:style=Medium |
결과를 보면 다음과 같은 정보를 보여준다. 설치된 폰트 파일(전체 경로 포함) 폰트 이름. 스타일. 스타일은 Regular, Bold, Italic 등이다. 옵션없이 실행하자 설치된 모든 폰트들을 보여준다. 이 명령어에는 필터 기능을 제공한다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
$ fc-list : lang=ko /usr/share/fonts/truetype/nanum/NanumSquareRoundB.ttf: 나눔스퀘어라운드,NanumSquareRound,NanumSquareRound Bold,나눔스퀘어라운드 Bold:style=Bold,Regular /usr/share/fonts/opentype/noto/NotoSerifCJK-Bold.ttc: Noto Serif CJK SC:style=Bold /usr/share/fonts/opentype/noto/NotoSerifCJK-Bold.ttc: Noto Serif CJK TC:style=Bold /usr/share/fonts/opentype/noto/NotoSansCJK-Black.ttc: Noto Sans CJK HK,Noto Sans CJK HK Black:style=Black,Regular /usr/share/fonts/opentype/noto/NotoSerifCJK-Bold.ttc: Noto Serif CJK JP:style=Bold /usr/share/fonts/opentype/noto/NotoSerifCJK-Bold.ttc: Noto Serif CJK KR:style=Bold /usr/share/fonts/truetype/nanum/NanumSquareRoundR.ttf: 나눔스퀘어라운드,NanumSquareRound,NanumSquareRound Regular,나눔스퀘어라운드 Regular:style=Regular /usr/share/fonts/truetype/nanum/NanumSquareB.ttf: 나눔스퀘어,NanumSquare,NanumSquare Bold,나눔스퀘어 Bold:style=Bold /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans CJK JP:style=Regular /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans CJK HK:style=Regular /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans CJK KR:style=Regular /usr/share/fonts/opentype/noto/NotoSansCJK-Black.ttc: Noto Sans CJK TC,Noto Sans CJK TC Black:style=Black,Regular /usr/share/fonts/opentype/noto/NotoSerifCJK-Medium.ttc: Noto Serif CJK KR,Noto Serif CJK KR Medium:style=Medium,Regular /usr/share/fonts/opentype/noto/NotoSansCJK-Black.ttc: Noto Sans CJK KR,Noto Sans CJK KR Black:style=Black,Regular /usr/share/fonts/truetype/wqy/wqy-microhei.ttc: WenQuanYi Micro Hei,文泉驛微米黑,文泉驿微米黑:style=Regular /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans CJK SC:style=Regular |
‘:’ 를 기준으로 필터를 줄 수 있다. 필터는 ‘:’ 를 기준으로 연달아 적어주면 되는데 위의 예제는 […]