출처

언어 설정

메뉴 [기본 설정] > [Raspberry Pi Configuration] 선택

탭 [Localisation] 선택

버튼 [Set Locale...] 선택하고, 팝업 창[Locale] 에서 Language, Character Set 설정

버튼 [Set Timezone...] 선택하고, 팝업 창[Timezone] 에서 Area, Location 설정

버튼 [Set Keyboard...] 선택하고, 팝업 창[Keyboard] 에서 Model, Layout, Variant 설정

버튼 [Set WiFi Country Code...] 선택하고, 팝업 창[WiFi Country Code] 에서 Country 설정

한글 입력기(uim) 설치

$ sudo apt-get install uim uim-byeoru fonts-unfonts-core

uim로 입력기 설정

$ im-config -n uim

입력기 설정 확인

$ cat .xinputrc 
## im-config(8) generated on Sat, 20 Oct 2018 21:14:47 +0900
run_im uim
## im-config signature: 7e7926db202ba349880ee57ac6ef0013  -

입력기 설정 후 재부팅

$ sudo shutdown -r now

uim 입력기 설정

메뉴 [기본 설정] > [Raspberry Pi Configuration] 선택

[디폴트 입력기 지정]에서 ]디폴트 입력기]를 [벼루]로 설정

[Display behavior]에서 [Display]를 Never로 설정

[전체] 켜기, [전체] 끄기를 한영전환키 설정과 충돌이 생기지 않도록 비워두고 적용

벼루 키 설정 1

Ubuntu 18.04 : Tomcat 설치

OS/Linux 2018.10.08 03:11 Posted by 파란크리스마스

출처

Tomcat 8.5 다운로드 및 압축해제

$ wget http://apache.tt.co.kr/tomcat/tomcat-8/v8.5.34/bin/apache-tomcat-8.5.34.tar.gz
$ tar xvf apache-tomcat-8.5.34.tar.gz
$ sudo mv apache-tomcat-8.5.34 /usr/local/

jdk 설치

$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java8-installer

서비스 파일 작성

$ sudo vi /etc/systemd/system/tomcat.service

[Unit]
Description=Apache Tomcat Web Application Container
After=network.target

[Service]
Type=forking

Environment=JAVA_HOME=/usr/lib/jvm/java-8-oracle
Environment=CATALINA_PID=/usr/local/apache-tomcat-8.5.34/temp/tomcat.pid
Environment=CATALINA_HOME=/usr/local/apache-tomcat-8.5.34
Environment=CATALINA_BASE=/usr/local/apache-tomcat-8.5.34
Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC'
Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom'

ExecStart=/usr/local/apache-tomcat-8.5.34/bin/startup.sh
ExecStop=/usr/local/apache-tomcat-8.5.34/bin/shutdown.sh

User=tomcat
Group=tomcat
UMask=0007
RestartSec=10
Restart=always

[Install]
WantedBy=multi-user.target

Tomcat 8.5 서비스 등록

$ sudo systemctl daemon-reload
$ sudo systemctl enable tomcat      (재부팅시 자동실행)
Created symlink from /etc/systemd/system/multi-user.target.wants/tomcat.service to /etc/systemd/system/tomcat.service.

Tomcat 8.5 서비스 실행

$ sudo systemctl start tomcat

Tomcat 8.5 서비스 실행 정보 확인

$ systemctl status tomcat.service
● tomcat.service - Apache Tomcat Web Application Container
   Loaded: loaded (/etc/systemd/system/tomcat.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2018-10-04 07:13:23 KST; 17s ago
  Process: 5797 ExecStart=/usr/local/apache-tomcat-8.5.34/bin/startup.sh (code=exited, status=0/SUCCESS)
 Main PID: 5805 (java)
    Tasks: 48 (limit: 4915)
   CGroup: /system.slice/tomcat.service
           └─5805 /usr/lib/jvm/java-8-oracle/bin/java -Djava.util.logging.config.file=/usr/local/apache-to
 
10월 04 07:13:23 bluesanta-ubuntu systemd[1]: Starting Apache Tomcat Web Application Container...
10월 04 07:13:23 bluesanta-ubuntu startup.sh[5797]: Using CATALINA_BASE:   /usr/local/apache-tomcat-8.5.34
10월 04 07:13:23 bluesanta-ubuntu startup.sh[5797]: Using CATALINA_HOME:   /usr/local/apache-tomcat-8.5.34
10월 04 07:13:23 bluesanta-ubuntu startup.sh[5797]: Using CATALINA_TMPDIR: /usr/local/apache-tomcat-8.5.34
10월 04 07:13:23 bluesanta-ubuntu startup.sh[5797]: Using JRE_HOME:        /usr/lib/jvm/java-8-oracle
10월 04 07:13:23 bluesanta-ubuntu startup.sh[5797]: Using CLASSPATH:       /usr/local/apache-tomcat-8.5.34
10월 04 07:13:23 bluesanta-ubuntu startup.sh[5797]: Using CATALINA_PID:    /usr/local/apache-tomcat-8.5.34
10월 04 07:13:23 bluesanta-ubuntu startup.sh[5797]: Tomcat started.
10월 04 07:13:23 bluesanta-ubuntu systemd[1]: Started Apache Tomcat Web Application Container.

Tomcat 8.5 서비스 종료

$ sudo systemctl stop tomcat

Ubuntu 18.04 : svn 설치

OS/Linux 2018.10.08 03:11 Posted by 파란크리스마스

출처

svn 설치

# apt-get install -y subversion

svn 환경파일(/conf/svnserve.conf) 수정

# vi /bluesanta/Repositories/conf/svnserve.conf

[general]
#인증되지않은(즉 계정이 없는) 사용자에 대해 접근을 거부한다.
anon-access = none
#인증된 사용자에 대해 쓰기 권한을 준다.
auth-access = write
#인증된 사용자에 대한 계정 정보(아이디/패스) 정보가 기록된 파일명을 의미한다.(기본값 passwd) 
password-db = passwd
#인증된 사용자에 대해 저장소에 대한 권한 설정이 기록된 파일명(기본값)
#authz-db = authz
#현재 파일에 해당되는 저장소의 영역에 대해 설정
#realm = bluesanta_proj

사용자 관리(/conf/passwd) 파일

# vi passwd

[users]
bluesanta = {password}

사용자 관리(/conf/authz) 파일

# vi authz

[/android_library]
bluesanta = rw

svn 시작

# svnserve -d -r /bluesanta/Repositories

svn 종료

# killall svnserve

svn 포트 개발(3690)

# firewall-cmd --permanent --zone=public --add-port=3690/tcp
# firewall-cmd --reload

svn editor 설정

# SVN_EDITOR=/usr/bin/vim
# export SVN_EDITOR

svn 기본 디렉토리 만들기

$ svn mkdir svn://localhost/work2

svn 데몬 자동실행

$ sudo vi /etc/rc.local

# Subversion
svnserve -d -r /bluesanta/Repositories

서비스 등록

$ vi svnserve

#! /bin/sh
### BEGIN INIT INFO
# Provides:          svnserve
# Required-Start:    $local_fs $syslog $remote_fs
# Required-Stop:     $local_fs $syslog $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start svnserve
### END INIT INFO

# Author: Michal Wojciechowski <odyniec@odyniec.net>

PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="svnserve"
NAME=svnserve
DAEMON=/usr/bin/$NAME
DAEMON_ARGS="-d -r /bluesanta/Repositories"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

[ -x "$DAEMON" ] || exit 0

[ -r /etc/default/$NAME ] && . /etc/default/$NAME

. /lib/init/vars.sh

. /lib/lsb/init-functions

do_start()
{
        start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
                || return 1
        start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
                $DAEMON_ARGS \
                || return 2
}

do_stop()
{
        start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
        RETVAL="$?"
        [ "$RETVAL" = 2 ] && return 2
        start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
        [ "$?" = 2 ] && return 2
        rm -f $PIDFILE
        return "$RETVAL"
}

case "$1" in
  start)
        [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
        do_start
        case "$?" in
                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
        esac
        ;;
  stop)
        [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
        do_stop
        case "$?" in
                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
        esac
        ;;
  restart|force-reload)
        log_daemon_msg "Restarting $DESC" "$NAME"
        do_stop
        case "$?" in
          0|1)
                do_start
                case "$?" in
                        0) log_end_msg 0 ;;
                        1) log_end_msg 1 ;; # Old process is still running
                        *) log_end_msg 1 ;; # Failed to start
                esac
                ;;
          *)
                # Failed to stop
                log_end_msg 1
                ;;
        esac
        ;;
  *)
        echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
        exit 3
        ;;
esac

exit 0

svnserve 파일 복사

$ sudo cp svnserve /etc/init.d
$ sudo chmod u+x /etc/init.d/svnserve 

서비스 등록

$ sudo update-rc.d svnserve defaults

서비스 실행

$ sudo service svnserve start

서비스 실행 정보 확인

$ sudo service svnserve status
● svnserve.service - LSB: Start svnserve
   Loaded: loaded (/etc/init.d/svnserve; generated)
   Active: active (running) since Wed 2018-10-03 21:37:05 KST; 11s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 2338 ExecStop=/etc/init.d/svnserve stop (code=exited, status=0/SUCCESS)
  Process: 2380 ExecStart=/etc/init.d/svnserve start (code=exited, status=0/SUCCESS)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/svnserve.service
           └─2387 /usr/bin/svnserve -d -r /bluesanta/Repositories

10월 03 21:37:05 bluesanta-ubuntu systemd[1]: Starting LSB: Start svnserve...
10월 03 21:37:05 bluesanta-ubuntu svnserve[2386]: DIGEST-MD5 common mech free
10월 03 21:37:05 bluesanta-ubuntu systemd[1]: Started LSB: Start svnserve.

Ubuntu 18.04 : MySQL 5.7.23 컴파일, 설치

Database 2018.10.08 03:09 Posted by 파란크리스마스

출처

Ubuntu server에 mysql 5.5.x 설치하기 -pupustory@- - Tistory
[Linux/CentOS] Mysql을 컴파일해서 설치해보자 - AT BLOG

리눅스 정보 조회

출처 : 리눅스 종류 확인, 리눅스 버전 확인 - 제타위키

$ cat /etc/*-release | uniq
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.3 LTS"
NAME="Ubuntu"
VERSION="14.04.3 LTS, Trusty Tahr"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 14.04.3 LTS"
VERSION_ID="14.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"

리눅스 비트 확인

출처 : 리눅스 32비트 64비트 확인 - 제타위키

$ getconf LONG_BIT
64

관련패키지 설치

$ sudo apt-get update
$ sudo apt-get install gcc g++ libncurses5-dev libxml2-dev openssl libssl-dev curl libcurl4-openssl-dev libjpeg-dev libpng-dev libfreetype6-dev libsasl2-dev autoconf libncurses5-dev

MySQL 계정 만들기

$ sudo groupadd mysql
$ sudo useradd -g mysql -s /bin/bash -m mysql

cmake 설치

$ sudo apt-get install cmake

MySQL 소스 다운로드, 압축해제, 컴파일, 설치

$ wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-boost-5.7.23.tar.gz
$ tar xvf mysql-boost-5.7.23.tar.gz
$ cd mysql-5.7.23
$ sudo cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql57 \
-DMYSQL_DATADIR=/usr/local/mysql57/data \
-DMYSQL_UNIX_ADDR=/usr/local/mysql57/mysql.sock \
-DSYSCONFDIR=/usr/local/mysql57 \
-DMYSQL_TCP_PORT=3306 \
-DMYSQL_USER=mysql \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS=all \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DDOWNLOAD_BOOST=0 -DWITH_BOOST=./boost
$ sudo make
$ sudo make install

환경설정

$ sudo vi /usr/local/mysql57/my.cnf

[mysqld]
# port=3306
# basedir=/usr/local/mysql57
# datadir=/usr/local/mysql57/data
# pid-file=/usr/local/mysql57/mysqld.pid
# log_error=/usr/local/mysql57/mysql_error.log
# lc-messages-dir=/usr/local/mysql57/share

init_connect=SET collation_connection = utf8_general_ci
init_connect=SET NAMES utf8
character-set-server=utf8
collation-server=utf8_general_ci
# table_cache=1024
max_connections=2048
max_user_connections=500
max_connect_errors=10000
wait_timeout=300
query_cache_type = 1
query_cache_size = 128M
query_cache_limit = 5M
slow_query_log
long_query_time=3
max_allowed_packet=16M
sort_buffer_size = 2M
# skip-innodb
skip-name-resolve
sql_mode = STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

[mysql]
default-character-set=utf8

[client]
default-character-set=utf8

MySQL 설치 디렉토리 mysql 계정으로 권한 수정

$ sudo chown -R mysql:mysql /usr/local/mysql57

MySQL 데이터베이스 초기화 (mysql 계정으로 실행)

$ cd /usr/local/mysql57
$ bin/mysql_install_db --no-defaults --user=mysql --datadir=/usr/local/mysql57/data --basedir=/usr/local/mysql57 -v
2018-10-03 15:26:47 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize
2018-10-03 15:26:47 [NOTE]    Creating data directory /usr/local/mysql57/data
2018-10-03 15:26:47 [NOTE]    Generating random password to /home/mysql/.mysql_secret...done.
2018-10-03 15:26:47 [NOTE]    Executing /usr/local/mysql57/bin/mysqld --no-defaults --bootstrap --datadir=/usr/local/mysql57/data --lc-messages-dir=/usr/local/mysql57/share --lc-messages=en_US --basedir=/usr/local/mysql57
2018-10-03 15:26:48 [NOTE]    Creating system tables...done.
2018-10-03 15:26:48 [NOTE]    Filling system tables with data...done.
2018-10-03 15:26:49 [NOTE]    Filling help table with data...done.
2018-10-03 15:26:49 [NOTE]    Creating user for internal session service...done.
2018-10-03 15:26:49 [NOTE]    Creating default user root@localhost
2018-10-03 15:26:49 [NOTE]    Creating default proxy root@localhost
2018-10-03 15:26:49 [NOTE]    Creating sys schema
2018-10-03 15:26:49 [NOTE]    done.
2018-10-03 15:26:51 [WARNING] The bootstrap log isn't empty:
2018-10-03 15:26:51 [WARNING] 2018-10-03T06:26:47.586650Z 0 [Warning] --bootstrap is deprecated. Please consider using --initialize instead

2018-10-03 15:26:51 [NOTE]    Generating SSL Certificates

MySQL 서비스 등록

서비스 mysqld 파일 복사

$ sudo cp /usr/local/mysql57/support-files/mysql.server /etc/init.d/mysqld57

mysqld 수정

$ sudo vi /etc/init.d/mysqld57

mysqld파일을 열어서 basedir에 mysql이 설치된 디렉토리와 데이터 디렉토리(datadir)를 설정한다.

basedir=/usr/local/mysql57
datadir=/usr/local/mysql57/data

mysqld 서비스 등록

$ sudo update-rc.d mysqld57 defaults

mysqld 서비스 실행

$ sudo systemctl start mysqld57.service
$ sudo systemctl status mysqld57.service
● mysqld57.service - LSB: start and stop MySQL
   Loaded: loaded (/etc/init.d/mysqld57; generated)
   Active: active (running) since Wed 2018-10-03 15:37:07 KST; 6min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 1042 ExecStart=/etc/init.d/mysqld57 start (code=exited, status=0/SUCCESS)
    Tasks: 28 (limit: 4915)
   CGroup: /system.slice/mysqld57.service
           ├─1071 /bin/sh /usr/local/mysql57/bin/mysqld_safe --datadir=/usr/local/mysql57/data --pid-file=/usr/local/mysql57/data/bluesa
           └─1469 /usr/local/mysql57/bin/mysqld --basedir=/usr/local/mysql57 --datadir=/usr/local/mysql57/data --plugin-dir=/usr/local/m

10월 03 15:37:06 bluesanta-ubuntu systemd[1]: Starting LSB: start and stop MySQL...
10월 03 15:37:06 bluesanta-ubuntu mysqld57[1042]: Starting MySQL
10월 03 15:37:07 bluesanta-ubuntu mysqld57[1042]: . *
10월 03 15:37:07 bluesanta-ubuntu systemd[1]: Started LSB: start and stop MySQL.
$ sudo systemctl stop mysqld57.service

root 암호 초기화

$ bin/mysqld_safe --skip-grant-tables &
[1] 21756
mysql@bluesanta-ubuntu:/usr/local/mysql57$ 2018-10-03T06:32:29.844112Z mysqld_safe Logging to '/usr/local/mysql57/data/bluesanta-ubuntu.err'.
2018-10-03T06:32:29.873395Z mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql57/data

mysql@bluesanta-ubuntu:/usr/local/mysql57$ bin/mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.23-log Source distribution

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

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

mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> update user set authentication_string = password('sqldba') where user = 'root';
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 1

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> quit
Bye

ERROR 1820 (HY000) 오류 해결

mysql> select 1;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> SET PASSWORD = PASSWORD('sql');
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql$gt; select 1;
+---+
| 1 |
+---+
| 1 |
+---+
1 row in set (0.00 sec)

mysql>

사용자 추가

mysql> create user 'user1'@'%' identified by 'userpw';
mysql> grant all privileges on *.* to 'user1'@'%' with grant option;
mysql> flush privileges;

사용자 추가

create user 'terecal'@'%' identified by '****';
GRANT ALL privileges ON terecal_db.* TO 'terecal'@'%';
flush privileges;

Ubuntu 18.04 : MySQL 8.0.12 컴파일, 설치

Database 2018.10.08 03:09 Posted by 파란크리스마스

출처

리눅스 정보 조회

출처 : 리눅스 종류 확인, 리눅스 버전 확인 - 제타위키

$ cat /etc/*-release | uniq
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.1 LTS"
NAME="Ubuntu"
VERSION="18.04.1 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.1 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic

리눅스 비트 확인

출처 : 리눅스 32비트 64비트 확인 - 제타위키

$ getconf LONG_BIT
64

관련패키지 설치

$ sudo apt-get update
$ sudo apt-get install gcc g++ libncurses5-dev libxml2-dev openssl libssl-dev curl libcurl4-openssl-dev libjpeg-dev libpng-dev libfreetype6-dev libsasl2-dev autoconf libncurses5-dev

cmake 설치

$ sudo apt-get install cmake

MySQL 계정 만들기

$ sudo groupadd mysql
$ sudo useradd -g mysql -s /bin/bash -m mysql

MySQL 소스 다운로드

$ wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.12.tar.gz

MySQL 소스 압축풀기

$ tar xvf mysql-8.0.12.tar.gz

MySQL 컴파일 및 설치

$ cd mysql-8.0.12/
$ sudo cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \
-DSYSCONFDIR=/usr/local/mysql \
-DMYSQL_TCP_PORT=3306 \
-DMYSQL_USER=mysql \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS=all \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local/mysql/boost
$ sudo make
$ sudo make install

MySQL 설치 디렉토리 mysql 계정으로 권한 수정

$ sudo chown -R mysql:mysql /usr/local/mysql

환경설정

$ vi /usr/local/mysql/my.cnf

[mysqld]
bind-address=0.0.0.0
port=3306
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
# pid-file=/usr/local/mysql/mysqld.pid
# log_error=/usr/local/mysql/mysql_error.log
# lc-messages-dir=/usr/local/mysql/share

init_connect=SET collation_connection = utf8_general_ci
init_connect=SET NAMES utf8
character-set-server=utf8
collation-server=utf8_general_ci
# table_cache=1024
max_connections=2048
max_user_connections=500
max_connect_errors=10000
wait_timeout=300
# query_cache_type = 1
# query_cache_size = 128M
# query_cache_limit = 5M
slow_query_log
long_query_time=3
max_allowed_packet=16M
sort_buffer_size = 2M
# skip-innodb
skip-name-resolve
# sql_mode = STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

[mysql]
default-character-set=utf8

[client]
default-character-set=utf8

MySQL 데이터베이스 초기화 (mysql 계정으로 실행)

$ cd /usr/local/mysql
$ bin/mysqld --defaults-file=/usr/local/mysql/my.cnf --initialize --console --user=mysql --datadir=/usr/local/mysql/data --basedir=/usr/local/mysql
2018-10-03T03:17:05.650419Z 0 [System] [MY-013169] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.12) initializing of server in progress as process 5644
2018-10-03T03:17:08.797874Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: q<chLu;Cy2yY
2018-10-03T03:17:10.426427Z 0 [System] [MY-013170] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.12) initializing of server has completed

MySQL 종료 (프로세스가 존재하는 경우)

$ bin/mysqld stop
2018-10-03T01:59:45.345444Z 0 [System] [MY-010116] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.12) starting as process 3662
2018-10-03T01:59:45.756978Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2018-10-03T01:59:45.761934Z 0 [ERROR] [MY-010147] [Server] Too many arguments (first extra is 'stop').
2018-10-03T01:59:45.761967Z 0 [Warning] [MY-010952] [Server] The privilege system failed to initialize correctly. If you have upgraded your server, make sure you're executing mysql_upgrade to correct the issue.
2018-10-03T01:59:45.762056Z 0 [ERROR] [MY-010119] [Server] Aborting
2018-10-03T01:59:47.444146Z 0 [System] [MY-010910] [Server] /usr/local/mysql/bin/mysqld: Shutdown complete (mysqld 8.0.12)  Source distribution.

root 암호 초기화

$ bin/mysqld_safe --skip-grant-tables &
[1] 3745
mysql@bluesanta-ubuntu:/usr/local/mysql$ 2018-10-03T03:20:12.286866Z mysqld_safe Logging to '/usr/local/mysql/data/bluesanta-ubuntu.err'.
2018-10-03T03:20:12.311924Z mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data

mysql@bluesanta-ubuntu:/usr/local/mysql$ bin/mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 8.0.12 Source distribution

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

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

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.03 sec)

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'sql';
Query OK, 0 rows affected (0.08 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)

mysql> quit
Bye

MySQL 서비스 등록

서비스 mysqld 파일 복사

$ sudo cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld

mysqld 수정

$ sudo vi /etc/init.d/mysqld

mysqld파일을 열어서 basedir에 mysql이 설치된 디렉토리와 데이터 디렉토리(datadir)를 설정한다.

basedir=/usr/local/mysql
datadir=/usr/local/mysql/data

mysqld 서비스 등록

$ sudo update-rc.d mysqld defaults
 Adding system startup for /etc/init.d/mysqld ...
   /etc/rc0.d/K20mysqld -> ../init.d/mysqld
   /etc/rc1.d/K20mysqld -> ../init.d/mysqld
   /etc/rc6.d/K20mysqld -> ../init.d/mysqld
   /etc/rc2.d/S20mysqld -> ../init.d/mysqld
   /etc/rc3.d/S20mysqld -> ../init.d/mysqld
   /etc/rc4.d/S20mysqld -> ../init.d/mysqld
   /etc/rc5.d/S20mysqld -> ../init.d/mysqld

mysqld 서비스 실행

$ sudo systemctl start mysqld.service
$ sudo systemctl status mysqld.service
● mysqld.service - LSB: start and stop MySQL
   Loaded: loaded (/etc/init.d/mysqld; generated)
   Active: active (running) since Wed 2018-10-03 11:58:26 KST; 32s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 4863 ExecStop=/etc/init.d/mysqld stop (code=exited, status=0/SUCCESS)
  Process: 4887 ExecStart=/etc/init.d/mysqld start (code=exited, status=0/SUCCESS)
    Tasks: 38 (limit: 4915)
   CGroup: /system.slice/mysqld.service
           ├─4895 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/bluesanta-ubuntu.pid
           └─4982 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysq
 
10월 03 11:58:25 bluesanta-ubuntu systemd[1]: Starting LSB: start and stop MySQL...
10월 03 11:58:25 bluesanta-ubuntu mysqld[4887]: Starting MySQL
10월 03 11:58:26 bluesanta-ubuntu mysqld[4887]: . *
10월 03 11:58:26 bluesanta-ubuntu systemd[1]: Started LSB: start and stop MySQL.
$ sudo systemctl stop mysqld.service

ERROR 1820 (HY000) 오류 해결

mysql> select 1;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> SET PASSWORD = PASSWORD('sql');
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql$gt; select 1;
+---+
| 1 |
+---+
| 1 |
+---+
1 row in set (0.00 sec)

mysql>

사용자 추가

mysql> create user 'user1'@'%' identified by 'userpw';
mysql> grant all privileges on *.* to 'user1'@'%' with grant option;
mysql> flush privileges;

사용자 추가

create user 'terecal'@'%' identified by '****';
GRANT ALL privileges ON terecal_db.* TO 'terecal'@'%';
flush privileges;

Raspberry Pi Zero : Inky pHAT

OS/Raspberry Pi 2018.10.08 02:55 Posted by 파란크리스마스

출처

spi 활성화

$ sudo raspi-config

개발도구 설치

$ sudo apt-get install python-dev python-setuptools

소스 다운로드 및 설치

$ wget -O InkypHAT.tar.gz https://github.com/pimoroni/inky-phat/archive/v0.1.0.tar.gz
$ tar xvf InkypHAT.tar.gz
$ cd inky-phat-0.1.0/library/
$ sudo python setup.py install

예제 실행

$ cd ~/inky-phat-0.1.0/examples/
$ python cal.py