달력

4

« 2020/4 »

  •  
  •  
  •  
  • 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
  •  
  •  

https://blog.sleeplessbeastie.eu/2018/03/14/how-to-install-restyaboard/

 

How to install Restyaboard on Debian Stretch

Install Restyaboard an open source kanban board. I am using it on daily basis to manage this blog. Restyaboard Update package index. $ sudo apt-get update Upgrade installed packages. $ sudo apt-get upgrade Install basic utilities. $ sudo apt-get install un

blog.sleeplessbeastie.eu

How to install Restyaboard on Debian Stretch

by Milosz Galazka on March 14, 2018 and tagged with DebianStretchSoftware recommendationRestyaboard

Install Restyaboard an open source kanban board. I am using it on daily basis to manage this blog.

This blog post is outdated. Install Restyaboard 0.6.8 on Debian Buster.

Restyaboard

기본적인 업데이트와 유틸리티를 설치합니다.

Update package index.

$ sudo apt-get update

Upgrade installed packages.

$ sudo apt-get upgrade

Install basic utilities.

$ sudo apt-get install unzip wget git

 

이제 디비 포스트그레SQL 을 설치합니다.

Install PostgreSQL server.

$ sudo apt-get install postgresql

Create user and password for Restyaboard application.

$ sudo -u postgres psql -c "CREATE ROLE restyaboard WITH LOGIN PASSWORD 'restyaboard'"

Create database.

$ sudo -u postgres createdb -O restyaboard -E UTF8 restyaboard

Configure database authentication for created user.

$ cat << EOF | sudo tee -a /etc/postgresql/9.6/main/pg_hba.conf 
# restyaboard 
host restyaboard restyaboard 127.0.0.1/32 md5 
EOF

Reload PostgreSQL server configuration.

$ sudo -u postgres psql -c "SELECT pg_reload_conf()"

 

이제 웹서버 - 엔진엑스를 설치합니다.

Install nginx web server.

$ sudo apt-get install nginx-full

Install PHP Fast Process Manager with additional modules.

$ sudo apt-get install php-fpm php-pgsql php-curl php-imagick php-mbstring php-xml

Specify default PHP timezone.

$ sudo sed -i -e "s/^;date.timezone =/date.timezone = Europe\/Warsaw/" /etc/php/7.0/fpm/php.ini

Reload PHP Fast Process Manager.

$ sudo systemctl reload php7.0-fpm

Create directory to store SSL certificate.

$ sudo mkdir /etc/nginx/ssl

Create single domain SSL certificate.

$ sudo openssl req -subj "/commonName=board.example.org/" -x509 -nodes -days 730 -newkey rsa:2048 -keyout /etc/nginx/ssl/nginx.key -out /etc/nginx/ssl/nginx.crt

Create nginx site configuration. It is the default configuration located in a project repository.

$ sudo cat << EOF | sudo tee /etc/nginx/sites-available/restyaboard 
server { 
#listen 80 default_server; 
listen 443 ssl; 
ssl_certificate ssl/nginx.crt; 
ssl_certificate_key ssl/nginx.key; 
server_name _; 

root /var/www/html; 
index index.html index.php; 
gzip on; 
gzip_disable "msie6"; 
gzip_comp_level 6; 
# gzip_comp_level 9; 
gzip_min_length 1100; 
gzip_buffers 16 8k; 
gzip_proxied any; 
# gzip_http_version 1.1; 
gzip_types text/plain application/xml text/css text/js text/xml application/x-javascript text/javascript application/json application/xml+rss; 

client_max_body_size 300M; 

rewrite ^/oauth/authorize$ /server/php/authorize.php last; 
rewrite ^/oauth_callback/([a-zA-Z0-9_\.]*)/([a-zA-Z0-9_\.]*)\$ /server/php/oauth_callback.php?plugin=\$1&code=\$2 last; 
rewrite ^/download/([0-9]*)/([a-zA-Z0-9_\.]*)\$ /server/php/download.php?id=\$1&hash=\$2 last; 
rewrite ^/ical/([0-9]*)/([0-9]*)/([a-z0-9]*).ics\$ /server/php/ical.php?board_id=\$1&user_id=\$2&hash=\$3 last; 
rewrite ^/api/(.*)$ /server/php/R/r.php?_url=\$1&\$args last; 
rewrite ^/api_explorer/api-docs/$ /client/api_explorer/api-docs/index.php last; 

location / { 
root /var/www/html/client; 
} 

location ~ \.php\$ { 
try_files \$uri =404; 
include fastcgi_params; 
fastcgi_pass unix:/run/php/php7.0-fpm.sock; 
fastcgi_index index.php; 
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name; 
fastcgi_param PHP_VALUE "upload_max_filesize=80M \n post_max_size=120M \n max_execution_time=200 \n max_input_time=200 \n memory_limit=256M"; 
} 

location ~* \.(css|js|less|html|ttf|woff|jpg|jpeg|gif|png|bmp|ico) { 
root /var/www/html/client; 
if (-f \$request_filename) { break; } 
rewrite ^/img/([a-zA-Z_]*)/([a-zA-Z_]*)/([a-zA-Z0-9_\.]*)\$ /server/php/image.php?size=\$1&model=\$2&filename=\$3 last; 
add_header Cache-Control public; 
add_header Cache-Control must-revalidate; expires 7d; 
} 

} 

EOF

Disable default nginx site.

$ sudo unlink /etc/nginx/sites-enabled/default

Enable configured site.

$ sudo ln -s /etc/nginx/sites-available/restyaboard /etc/nginx/sites-enabled/

Reload nginx configuration.

$ sudo systemctl reload nginx

Remove default index file.

$ sudo rm /var/www/html/index.nginx-debian.html

 

이제 레스티아보드를 설치합니다.

Download recent Restyaboard release.

$ wget https://github.com/RestyaPlatform/board/releases/download/v0.6.1/board-v0.6.1.zip

Extract application to the /var/www/html/ directory.

$ sudo unzip -d /var/www/html/ board-v0.6.1.zip

Change user and group to www-data:www-data.

$ sudo chown -R www-data:www-data /var/www/html

Configure database access.

$ sudo sed -i -e "/^define('R_DB_HOST'/c\define('R_DB_HOST', 'localhost');" /var/www/html/server/php/config.inc.php 
$ sudo sed -i -e "/^define('R_DB_USER'/c\define('R_DB_USER', 'restyaboard');" /var/www/html/server/php/config.inc.php 
$ sudo sed -i -e "/^define('R_DB_PASSWORD'/c\define('R_DB_PASSWORD', 'restyaboard');" /var/www/html/server/php/config.inc.php 
$ sudo sed -i -e "/^define('R_DB_NAME'/c\define('R_DB_NAME', 'restyaboard');" /var/www/html/server/php/config.inc.php 
$ sudo sed -i -e "/^define('R_DB_PORT'/c\define('R_DB_PORT', 5432);" /var/www/html/server/php/config.inc.php

Load database schema.

$ sudo cat restyaboard/var/www/html/sql/restyaboard_with_empty_data.sql | psql restyaboard --username=restyaboard --password --host=localhost

Get basic board applications.

$ sudo git clone https://github.com/RestyaPlatform/board-apps.git /var/www/html/client/apps

Remove .git directory, alternatively you can deny access to this directory using nginx.

$ sudo rm -rf /var/www/html/client/apps/.git

Fix permissions for additional applications.

$ sudo chown -R www-data:www-data /var/www/html/client/apps

Restyaboard installation process does not require any special actions. Official installer performs too many operations, so I decided to describe it using simplest possible way. Just remember to change passwords.

Additional information

Restyaboard » Install & Configure

Restyaboard » Apps

Posted by 멋지다마라송

댓글을 달아 주세요

2019. 4. 17. 12:07

Installing Nagios Agent (NRPE) on CentOS 7 Tech/Linux2019. 4. 17. 12:07

Installing Nagios Agent (NRPE) on CentOS 7

CloudwaferHQ - July 13, 2018

 

After installing Nagios on our server, the next step is to install the Nagios agent. " Nagios Remote Plugin Executor". With NRPE, Nagios Administrators can use NRPE to monitor Linux servers as it allows you to remotely execute plugins/commands on our Linux machines and get the result back of the executed command.

 

In this guide, we will install NRPE on our CentOS 7 in order for it to be monitored through a Nagios server.

 

Deploying your cloud server
If you have not already registered with Cloudwafer, you should begin by getting signed up. Take a moment to create an account after which you can easily deploy your own cloud servers.

Once you have signed up, log into your Cloudwafer Client Area with the password provided in your mail and deploy your Cloudwafer cloud server.

 

Step 1: Install EPEL Repository
The NRPE packages and plugins which will be installed are available under the EPEL yum repository, Enable EPEL repository using one of the below commands.

rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm

 

Step 2: Install NRPE and NRPE-plugins
Type the commands below to enable the EPEL repository followed by the command below to install NRPE and its plugins.

yum --enablerepo=epel -y install nrpe nagios-plugins

yum install -y nrpe nagios-plugins-all

 

Step 3: Configure NRPE Add-on

Next, we need to modify the NRPE configuration file to accept connection from the Nagios server by editing the /etc/nagios/nrpe.cfg file.

nano /etc/nagios/nrpe.cfg

Add the Nagios servers IP address, separated by comma like below.

allowed_hosts=127.0.0.1,192.168.1.1

 

Step 4: Configure Nagios Checks
There are some basic attributes and services to monitor on a Linux server which includes the CPU, Memory, Disk, HTTP, FTP, etc. The /etc/nagios/nrpe.cfg file contains the basic commands to check these attributes and services on remote hosts.

Listed below are some command lines that lets you monitor attributes with the help of Nagios plugins.

Note: The path to Nagios plugins may change depends on your operating system architecture (i386 or x86_64)

command[check_users]=/usr/lib64/nagios/plugins/check_users -w 5 -c 10

command[check_load]=/usr/lib64/nagios/plugins/check_load -w 15,10,5 -c 30,25,20

command[check_root]=/usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -p /dev/mapper/centos-root

command[check_swap]=/usr/lib64/nagios/plugins/check_swap -w 20% -c 10%

command[check_total_procs]=/usr/lib64/nagios/plugins/check_procs -w 150 -c 200

Note: In the above command definition -w stands for warning and -c stands for critical.

 

Step 5: Restart NRPE
After entering the commands, restart the NRPE service:

systemctl start nrpe 
systemctl enable nrpe

 

Step 6 – Test NRPE from Nagios Server
Lastly, login to the Nagios server and execute the following command to verify that Nagios server is able to connect to clients NRPE services.

check_nrpe -H 196.168.1.2

If the connection is successful, it will show a version of clients NRPE package.

 

원본글 : https://cloudwafer.com/blog/installing-nagios-agent-npre-on-centos/

 

Installing Nagios Agent (NRPE) on CentOS 7

After installing Nagios on our server, the next step is to install the Nagios agent. " Nagios Remote Plugin Executor". With NRPE, Nagios Administrators can use NRPE to monitor Linux servers as it allows you to remotely execute plugins/commands on our Linux

cloudwafer.com

 

Posted by 멋지다마라송

댓글을 달아 주세요

2019. 4. 5. 21:03

크론탭 crontab 정리 Tech/Linux2019. 4. 5. 21:03

/etc/crontab 파일 - 설정방법 정리.

 

리눅스에서 정해진 시간마다 특정 파일을 실행할 수 있게 해주는 크론 cron 이 있습니다.

 

크게 /etc/crontab 파일을 수정하는 방법과,

로그인 계정마다 실행 주기와 실행 파일을 지정할 수 있는 crontab 실행파일이 있습니다.

 

서로 혼동될 수 있으니 두가지 방법중에서 하나를 정해 그거만 사용하는게 좋습니다.

 

저는 첫번째 방법인 /etc/crontab 파일만 사용합니다.

 

vi 로 파일을 열어서 수정하면 되고, 띄어쓰기나 탭으로 구분합니다.

 

구분되는 필드의 의미는 순서대로 

분   시   일   월   요일   유저   실행커멘드.가 됩니다.

 

분 : 0-59

시 : 0-23

일 : 1-31

월 : 1-12 

요일 : 0-7 (0과 7은 일요일입니다. 1=월요일)

 

 

예를 보면 쉽습니다.

 

매시 17분 : 한시간에 한번 실행.

17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly

 

매일 06시 25분 : 하루에 한번 실행.

25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )

 

매주 일요일 06시 47분 : 일주일에 한번 실행.
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )

 

매월 1일, 06시 52분에 실행 : 한달에 한번 실행.
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )

 

콤마 구분으로 여러개 지정, 나누어 떨어지는 숫자 지정 등도 가능합니다.

 

 

 

5분마다 실행.

*/5 * * * * root /bin/bash /root/bin/e5m.sh

 

00시 00분, 12시 00분에 실행.

00 00,12 * * * root /bin/bash /root/bin/2h.sh

 

짝수날 06시 25분 : 짝수날 한번 실행.

25 6  */2 * *   root /bin/bash /root/bin/e2d.sh

 

짝수달 01일 00시 00분에 실행 : 두달에 한번 실행.

00 00 01 */2 * root /bin/bash /root/bin/e2m.sh

Posted by 멋지다마라송

댓글을 달아 주세요

2018. 10. 18. 23:56

Bash - if 구문 Tech/Linux2018. 10. 18. 23:56


Bash - if 구문 


  1. #!/bin/bash
  2. # else example
  3. if [ $# -eq 1 ]
  4. then
  5. nl $1
  6. else
  7. nl /dev/stdin
  8. fi
OperatorDescription
! EXPRESSIONThe EXPRESSION is false.
-n STRINGThe length of STRING is greater than zero.
-z STRINGThe lengh of STRING is zero (ie it is empty).
STRING1 = STRING2STRING1 is equal to STRING2
STRING1 != STRING2STRING1 is not equal to STRING2
INTEGER1 -eq INTEGER2INTEGER1 is numerically equal to INTEGER2
INTEGER1 -gt INTEGER2INTEGER1 is numerically greater than INTEGER2
INTEGER1 -lt INTEGER2INTEGER1 is numerically less than INTEGER2
-d FILEFILE exists and is a directory.
-e FILEFILE exists.
-r FILEFILE exists and the read permission is granted.
-s FILEFILE exists and it's size is greater than zero (ie. it is not empty).
-w FILEFILE exists and the write permission is granted.
-x FILEFILE exists and the execute permission is granted.


TAG Bash, IF, Shell, 배시
Posted by 멋지다마라송

댓글을 달아 주세요

리눅스 서버 관리 - Parallel SSH - SSH 를 이용해서 여러대 리눅스 머신으로 명령어 보내기


중앙 서버에서 여러대의 리눅스 서버로 명령어를 보내도록 만들어서 편하게 관리할 수 있습니다.


먼저 Parallel SSH 를 설치합니다. 유저 user 는 루트 root 로 설치합니다.

# Debian 또는 Ubuntu
apt install python-pip python-setuptools
pip install parallel-ssh
apt install pssh

# 레드헷 RHEL, CentOS
yum install python-pip python-setuptools
pip install parallel-ssh
yum install pssh



아래와 같이 3대의 서버가 있다고 한다면,

1번 서버 : 192.168.1.100 : 중앙서버 : 이 서버에만 로그인을 해서 명령을 실행합니다.

2번 서버 : 192.168.1.101 : 호스트1 : 원격 명령이 실행될 서버1

3번 서버 : 192.168.1.102 : 호스트2 : 원격 명령이 실행될 서버2


1번 서버 : 중앙서버에서 SSH 퍼블릭 키를 만듭니다.


marasong@vm-marasong:~$ ssh-keygen -t rsa

Generating public/private rsa key pair.

Enter file in which to save the key (/home/marasong/.ssh/id_rsa): [엔터]

Enter passphrase (empty for no passphrase): [엔터]

Enter same passphrase again: [엔터]

Your identification has been saved in /home/marasong/.ssh/id_rsa.

Your public key has been saved in /home/marasong/.ssh/id_rsa.pub.

The key fingerprint is:


생성된 퍼블릭 키값을 호스트1, 2 두 서버에 복사합니다.

cat ~/.ssh/id_rsa.pub 


이런 형태로 나오는데,

2번 서버 : 192.168.1.101 / 3번 서버 : 192.168.1.102 : ~/.ssh/authorized_keys 파일에 저 내용을 복사합니다.


2번, 3번 서버에 .ssh 디렉토리가 없다면 디렉토리를 만들고 퍼미션을 수정합니다.

mkdir .ssh

chmod 700 .ssh

chmod 640 .ssh/authorized_keys


이제 1번 서버에서 2번, 3번 서버로 ssh 로그인을 해봅니다. 암호 없이 로그인이 가능해야 합니다.

ssh userID@192.168.1.101 -p 22

ssh userID@192.168.1.102 -p 22



2번, 3번 서버 정보를 hosts.test 파일로 저장합니다.


userID@192.168.1.101:22

userID@192.168.1.102:22


이제 아래와 같은 방법으로 여러 서버로 명령을 내릴 수 있습니다.


/usr/bin/parallel-ssh -i -h hosts.test "ls -al"




이걸 아래처럼 배시 스크립트로 만들어두면 편하게 이용할 수 있습니다.


#!/bin/bash


cmd_text=${1}


if [ -z "${cmd_text}" ]

then

        # 입력 파라미터 값이 없을때 기본값 정의

        cmd_text="ls"

fi


/usr/bin/parallel-ssh -i -h /home/ubuntu/hosts.test "${cmd_text}"



참고 : https://www.tecmint.com/




Posted by 멋지다마라송

댓글을 달아 주세요