레이블이 service인 게시물을 표시합니다. 모든 게시물 표시
레이블이 service인 게시물을 표시합니다. 모든 게시물 표시

2022년 4월 15일 금요일

OpenStack Yoga 클라우드 구성

 Openstack 25번째  Y 릴리즈 Yoga 버전의 클라우드 구성입니다.

각 프로젝트 이름과 어떤 일을 하는 것인지 정리했습니다. 
## OpenStack 기능별 구성요소
서비스프로젝트 코드설명
Identity ServiceKeystone사용자 인증
Compute ServiceNova가상머신 관리
Image ServiceGlance커널 이미지나 디스크이미지와 같은 가상 이미지를 관리

DashboardHorizonWeb브라우저를 통한 GUI 콘솔
Object StorageSwift클라우드 스토리지 AWS S3와 API 호환
Block StorageCinder가상머신이 사용하는 블록스토리지를 관리
Network ServiceNeutron가상 네트워크를 관리 
Load Balancing ServiceOctavia부하분산기능을 제고
Orchestration ServiceHeat가상머신 오케스트레이션을 기능 
Metering ServiceCeilometer과금용 사용량 계측기능을 제공
Database ServiceTrove데이터베이스 자원을 관리 
Container ServiceMagnum콘테이너 관리
Data Processing ServiceSahara데이터 프로세싱 서비스
Bare Metal ProvisioningIronic베어메탈 프로비져닝 
Shared File SystemManila화일 공유 기능 
DNS ServiceDesignateDNS 서버 기능 
Key Manager ServiceBarbican각종 인증키 관리 기능 

2015년 6월 25일 목요일

CentOS 7.x에서 MariaDB 서버 설치

CentOS 7.x에서 MariaDB 서버 설정

  • CentOS 7.x에서 데이터 베이스(DB)를 설치해 보자.

yum으로 mariadb-server 를 설치한다.

[root@localhost ~]# yum -y install maridb-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
...

Complete!

mariaDB 서버 환경을 설정

  • 환경 파일 위치
    /etc/my.cnf
  • 편집기로 화일을 수정하자.
    [root@localhost ~]# vi /etc/my.cnf
[mysqld]
# [mysqld]의 섹션에 문자셋(utf-8) 설정을 추가하자.
character-set-server=utf8

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

[mysqld_safe]
...

실행 및 서비스 등록

  • 서비스 실행
    [root@localhost ~]# systemctl start mariadb
  • 서비스 등록
    [root@localhost ~]# systemctl enable mariadb

MariaDB 초기 설정

[root@localhost ~]# mysql_secure_installation
/usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found

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.

# root 패스워드 설정
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!

동작확인

  • 설치한 MariaDB가 정상동작하는 지 확인해 보자.
    [root@localhost ~]# mysql -u root -p
# 앞에서 설정한 root 비밀번호를 입력하자.
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 16
Server version: 5.5.41-MariaDB MariaDB Server

Copyright (c) 2000, 2014, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

# 사용자 데이터 베이스를 확인해 보자.
MariaDB [(none)]> select user,host,password from mysql.user;
+------+-----------+-------------------------------------------+
| user | host      | password                                  |
+------+-----------+-------------------------------------------+
| root | localhost | *xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
| root | 127.0.0.1 | *xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
| root | ::1       | *xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
+------+-----------+-------------------------------------------+
3 rows in set (0.00 sec)

# 데이터베이스 확인 
MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)

MariaDB [(none)]> exit
Bye

2015년 6월 5일 금요일

Docker on CentOS 7.x

CentOS7에서 docker 설치와 사용

docker 설치

yum install -y docker

docker 서비스 시작

systemctl start docker

docker 서비스 활성화

systemctl enable docker

Docker 이미지를 다운로드

docker pull {이미지 이름} : {태그 이름}
  • 다운로드 한 Docker 이미지의 목록을 보려면
docker images

Docker 컨테이너를 작성 / 실행

docker run [옵션] [- name {컨테이너 이름} {이미지 이름} : {태그 이름}] [컨테이너에서 실행하는 명령 인수]
  • 주요 옵션
    • -d : 백그라운드에서 실행 (후술). 기본적으로 컨테이너를 포 그라운드에서 실행하기 위해 Web 서버와 애플리케이션 서버 등 항상 실행하는 컨테이너를 지정합니다.
    • -i : 컨테이너의 표준 입력을 연다. / bin / bash 등으로 컨테이너를 조작 할 때 지정한다.
    • -t : tty (터미널 장치)를 확보한다. / bin / bash 등으로 컨테이너를 조작 할 때 지정.
    • -p : {호스트의 포트 번호} {컨테이너의 포트 번호} : Docker 서버의 호스트와 포트 매핑을 구성

Docker 컨테이너 목록을 검색

docker ps [-a]
  • -a : 정지 중 컨테이너가 표시됩니다.

docker 컨테이너 시작

docker start {컨테이너 이름}

docker 컨테이너 연결

docker attach {컨테이너 이름}

Docker 이미지 생성

docker commit {컨테이너 이름} | {컨테이너 ID} {사용자 이름} /] {이미지 이름}

Docker 컨테이너 삭제

docker rm {컨테이너 이름} | {컨테이너 ID}

Docker 이미지 삭제

docker rmi {이미지 이름} | {이미지 ID}

2015년 5월 29일 금요일

OpenWRT on RaspberryPI 2

OpenWRT on RasberryPI 2

build env.

  • To build SD card image using Ubuntu 14.04.2 LTS (64-bit)
I: Preparing Ubuntu:
sudo apt-get update
sudo apt-get install git-core build-essential libssl-dev
sudo apt-get install subversion mercurial
II: Download the OpenWRT with git:
git clone git://git.openwrt.org/openwrt.git
  • check created a directory 'openwrt'
III: Download and install all available "feeds":
cd openwrt
./scripts/feeds update -a
./scripts/feeds install -a
iV: Make OpenWrt
make defconfig
make prereq
make menuconfig
V: Setup Wi-Fi kernel modules
  • select your Wifi USB stick module on config windows
Vi: set component in LuCI->Collections
  • select LuCI->Collections
Vii: Save and exit
  • select save
  • select exit
Viii: build
make -j 3
  • if you have some errors. please check message it
make V=s 2>&1 | tee build.log | grep -i error
iX: make SD card
cd openwrt/bin/brcm2708
You will be find "openwrt-brcm2708-bcm2709-sdcard-vfat-ext4.img"
sudo dd if=openwrt-brcm2708-bcm2709-sdcard-vfat-ext4.img of=/dev/sdX bs=2M conv=fsync
  • sdX - put your SD card dev (sdb, sdc, ..).
X: start OpenWRT
  • Insert SD on Raspberry PI 2
  • Connect UART-USB cable
  • Insert WiPi stick
  • Connect power.

    Reference Raspberry PI2 GPIO

  • Pin#08: TXD0
  • Pin#10: RXD0
  • Pin#14: GND
Xi: setup new passwd On UART-USB console
passwd
Xii: Reboot Raspberry PI 2 On UART-USB console
reboot
Xiii: Install LuCI On UART-USB console
vi /etc/opkg.conf
  • fix opkg.conf file
opkg update
opkg install luci
opkg install luci-ssl
opkg list | grep luci-i18n-
/etc/init.d/uhttpd start
/etc/init.d/uhttpd enable
  • WiFi connect to use Access Point
mkdir /etc/wpa_supplicant
vi /etc/wpa_supplicant/wpa_supplicant.conf
  • /etc/wpa_supplicant/wpa_supplicant.conf
update_config=1
network={
        ssid="AP name"
        psk="your key"
        scan_ssid=1
        proto=WPA RSN
        key_mgmt=WPA-PSK
        group=CCMP TKIP
        pairwise=CCMP TKIP
        priority=5
}
  • Start Wi-Fi connection in background task:
wpa_supplicant -Dnl80211 -iwlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf &
  • Setting resolving server in /etc/resolv.conf:
vi /etc/resolv.conf
nameserver <put your router IP here>
nameserver 8.8.8.8
  • Save file run:
route add default gw <put your router IP here>

2015년 3월 29일 일요일

CentOS 7.0 + nginx + uwsgi + Flask

CentOS 7.0.1406 + uwsgi 2.0.10 + nginx 1.6.2 + Flask 0.10.1


nginx 설치

shell
yum install epel-release
sed -ri 's/^enabled.*=.*1$/enabled = 0/g' /etc/yum.repos.d/epel.repo
yum install nginx --enablerepo=epel
vi /etc/nginx/nginx.conf
/etc/nginx/nginx.conf
user  nginx;
worker_processes  1;
error_log  /var/log/nginx/error.log;
pid        /run/nginx.pid;
events {
    worker_connections  1024;
}
http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    access_log  /var/log/nginx/access.log  main;
    sendfile        on;
    keepalive_timeout  65;
    index   index.html index.htm;
    include /etc/nginx/conf.d/*.conf;
    server {
        listen       80 default_server;
        server_name  localhost;
        root         /usr/share/nginx/html;
        include /etc/nginx/default.d/*.conf;
        location / {
                include uwsgi_params;
                uwsgi_pass unix:/var/lib/nginx/tmp/uwsgi/uwsgi.sock;
        }
        error_page  404              /404.html;
        location = /40x.html {
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
        }
    }
}
shell
systemctl enable nginx.service
systemctl start  nginx.service
systemctl status nginx.service

FLASK 설치

shell
yum install gcc python-devel
curl https://bootstrap.pypa.io/get-pip.py | python
pip install flask
mkdir -p /var/www/flask/
vi /var/www/flask/index.wsgi
/var/www/flask/index.wsgi
import sys
from flask import Flask
sys.path.append('/var/www/flask')
application = Flask(__name__)
@application.route('/')
def index():
    return 'HelloWorld'

uWSGI 설치

shell
yum install pcre-devel openssl-devel zlib-devel
pip install uwsgi
vi /etc/nginx/uwsgi.ini
/etc/nginx/uwsgi.ini
#http://uwsgi-docs.readthedocs.org/en/latest/Systemd.html
[uwsgi]
socket      = /var/lib/nginx/tmp/uwsgi/uwsgi.sock
python-path = /var/www/flask
wsgi-file   = /var/www/flask/index.wsgi
uid         = nginx
gid         = nginx
processes   = 4
threads     = 2
stats       = 127.0.0.1:9191
shell
vi /etc/systemd/system/uwsgi.service
/etc/systemd/system/uwsgi.service
[Unit]
Description=uWSGI
After=syslog.target

[Service]
ExecStart=/bin/uwsgi --ini /etc/nginx/uwsgi.ini
Restart=always
KillSignal=SIGQUIT
Type=notify
StandardError=syslog
NotifyAccess=all

[Install]
WantedBy=multi-user.target
shell
systemctl enable uwsgi.service
systemctl start  uwsgi.service
systemctl status uwsgi.service

firewalld

shell
firewall-cmd --permanent --add-service=http
firewall-cmd --reload