NanoPi NEO2 V1.0

OS/NanoPi 2019.01.26 21:53 Posted by 파란크리스마스

출처

NanoPi NEO2 V1.0

Wifi 없음. eMMC 없음 / NanoPi NEO Core2 - eMMC 8G

기본 암호

pi

   User Name: pi
   Password: pi

root

   User Name: root
   Password: fa

UART 부팅

UART 전원으로 전력이 부족하므로 UART의 VCC를 빼고 별도의 전원을 연결하여 사용

 NanoPi-NEO2 ttyS0

NanoPi-NEO2 login: pi
Password: pi
To run a command as administrator (user "root"), use "sudo ".
See "man sudo_root" for details.

pi@NanoPi-NEO2:~$

Node.js 8.x 설치 설치

Programming/Node.js 2019.01.26 13:13 Posted by 파란크리스마스

출처

Node.js 8.x 설치

$ curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
$ sudo apt-get install -y nodejs

Node.js 버전 확인

$ node --version
v8.15.0

Express 설치

$ sudo npm install -g express
+ express@4.16.4
added 48 packages from 36 contributors in 16.445s

Express 애플리케이션 생성기 설치

$ sudo npm install express-generator -g
/usr/bin/express -> /usr/lib/node_modules/express-generator/bin/express-cli.js
+ express-generator@4.16.0
added 10 packages from 13 contributors in 5.69s

Express 애플리케이션 만들기

$ express myapp
 
  warning: the default view engine will not be jade in future releases
  warning: use `--view=jade' or `--help' for additional options
 
 
   create : myapp/
   create : myapp/public/
   create : myapp/public/javascripts/
   create : myapp/public/images/
   create : myapp/public/stylesheets/
   create : myapp/public/stylesheets/style.css
   create : myapp/routes/
   create : myapp/routes/index.js
   create : myapp/routes/users.js
   create : myapp/views/
   create : myapp/views/error.jade
   create : myapp/views/index.jade
   create : myapp/views/layout.jade
   create : myapp/app.js
   create : myapp/package.json
   create : myapp/bin/
   create : myapp/bin/www
 
   change directory:
     $ cd myapp
 
   install dependencies:
     $ npm install
 
   run the app:
     $ DEBUG=myapp:* npm start

Express 애플리케이션 초기화

$ cd myapp
$ sudo npm install
audited 194 packages in 9.077s
found 2 low severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details

Express 애플리케이션 실행

$ DEBUG=myapp:* npm start
 
> myapp@0.0.0 start /home/pi/workspace/myapp
> node ./bin/www
 
  myapp:server Listening on port 3000 +0ms
GET / 200 2337.812 ms - 170
GET /stylesheets/style.css 200 28.972 ms - 111
GET /favicon.ico 404 165.796 ms - 1062

브라우져로 확인

MariaDB 설치 - 원격 접속 설정

OS/Linux 2019.01.26 13:07 Posted by 파란크리스마스

출처

MariaDB 설치

$ sudo apt install mariadb-server

MariaDB 초기화 - 권한 설정(mysql_secure_installation)

$ sudo 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): 

root 암호 설정 여부

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] 

root 암호 설정

New password: mariadb!
Re-enter new password: mariadb! 
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] 

root 원격 접속 여부

 ... 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] 

test 데이터베이스 삭제 여부

 ... 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] 

지금까지 설정한 권한 정보 적용 여부

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

설정 완료

 ... 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!

원격 접속 허용 하기 (환경파일 : /etc/mysql/my.cnf 수정)

$ sudo vi /etc/mysql/my.cnf

내용추가

[mysqld]    
bind-address = 0.0.0.0

/etc/mysql/my.cnf 전체

# The MariaDB configuration file
#
# The MariaDB/MySQL tools read configuration files in the following order:
# 1. "/etc/mysql/mariadb.cnf" (this file) to set global defaults,
# 2. "/etc/mysql/conf.d/*.cnf" to set global options.
# 3. "/etc/mysql/mariadb.conf.d/*.cnf" to set MariaDB-only options.
# 4. "~/.my.cnf" to set user-specific options.
#
# If the same option is defined multiple times, the last one will apply.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.

#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[client-server]

# Import all .cnf files from configuration directory
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mariadb.conf.d/

[mysqld]
bind-address = 0.0.0.0

서비스 등록

$ sudo systemctl enable mariadb
$ sudo systemctl start mariadb
$ sudo systemctl status mariadb
● mariadb.service - MariaDB 10.1.34 database server
   Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2019-01-26 03:22:15 UTC; 7min ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
 Main PID: 1113 (mysqld)
   Status: "Taking your SQL requests now..."
    Tasks: 27 (limit: 855)
   CGroup: /system.slice/mariadb.service
           └─1113 /usr/sbin/mysqld
 
Jan 26 03:22:10 orangepizero systemd[1]: Starting MariaDB 10.1.34 database server...
Jan 26 03:22:13 orangepizero mysqld[1113]: 2019-01-26  3:22:13 3069987648 [Note] /usr/sbin/mysqld (mysqld 10.1.3
Jan 26 03:22:15 orangepizero systemd[1]: Started MariaDB 10.1.34 database server.
Jan 26 03:22:15 orangepizero /etc/mysql/debian-start[1351]: /usr/bin/mysql_upgrade: the '--basedir' option is al
Jan 26 03:22:15 orangepizero /etc/mysql/debian-start[1351]: Looking for 'mysql' as: /usr/bin/mysql
Jan 26 03:22:15 orangepizero /etc/mysql/debian-start[1351]: Looking for 'mysqlcheck' as: /usr/bin/mysqlcheck
Jan 26 03:22:15 orangepizero /etc/mysql/debian-start[1351]: This installation of MySQL is already upgraded to 10
Jan 26 03:22:15 orangepizero /etc/mysql/debian-start[1362]: Checking for insecure root accounts.
Jan 26 03:22:15 orangepizero /etc/mysql/debian-start[1366]: Triggering myisam-recover for all MyISAM tables and 
pi@orangepizero:~$ netstat -tnlp | grep 3306

MariaDB 포트 확인

$ netstat -tnlp | grep 3306
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      -                   

MariaDB 접속

$ su -
Password: 
 
# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 30
Server version: 10.1.34-MariaDB-0ubuntu0.18.04.1 Ubuntu 18.04
 
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
MariaDB [(none)]> 

사용자 추가

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 54
Server version: 10.1.34-MariaDB-0ubuntu0.18.04.1 Ubuntu 18.04
 
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
MariaDB [(none)]> create user 'user1'@'%' identified by 'user1!!';
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [(none)]> grant all privileges on *.* to 'user1'@'%' with grant option;
Query OK, 0 rows affected (0.01 sec)
 
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [(none)]> exit
Bye

user1 접속

$ mysql -u user1 -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 36
Server version: 10.1.34-MariaDB-0ubuntu0.18.04.1 Ubuntu 18.04
 
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
MariaDB [(none)]> 

사용자 목록 조회

MariaDB [(none)]> select user, host from mysql.user;
+-------+-----------+
| user  | host      |
+-------+-----------+
| user1 | %         |
| root  | localhost |
| user1 | localhost |
+-------+-----------+
3 rows in set (0.00 sec)

출처

Python 설치

$ sudo apt install python

Android NDK(C/C++) 다운로드, 압축 해제

$ wget https://dl.google.com/android/repository/android-ndk-r16b-linux-x86_64.zip
$ sudo mv android-ndk-r16b-linux-x86_64.zip /opt/
$ cd /opt/
$ sudo unzip android-ndk-r16b-linux-x86_64.zip

NDK 경로 path에 추가

$ echo 'export ANDROID_NDK_ROOT=/opt/android-ndk-r16b' | tee -a ~/.bashrc
$ echo 'export PATH=$PATH:$ANDROID_NDK_ROOT' | tee -a ~/.bashrc

.profile-ndk 파일 작성

$ vi ~/.profile_ndk

.profile-ndk 내용

export ANDROID_NDK_ROOT=/opt/android-ndk-r16b
export NDK_TOOLCHAIN_VERSION=4.7
export TOOLCHAIN=/opt/android-14-toolchain
 
export PATH=$TOOLCHAIN/bin:$PATH

.profile-ndk 실행 (NDK 빌드시 사용)

$ chmod a+x ~/.profile_ndk 
$ source ~/.profile_ndk

toolchain 설치

$ sudo $ANDROID_NDK_ROOT/build/tools/make-standalone-toolchain.sh \
--verbose \
--toolchain=arm-linux-androideabi-4.7 \
--install-dir=$TOOLCHAIN \
--platform=android-14
HOST_OS=linux
HOST_EXE=
HOST_ARCH=x86_64
HOST_TAG=linux-x86_64
HOST_NUM_CPUS=8
BUILD_NUM_CPUS=16
Auto-config: --arch=arm
## COMMAND: python /opt/android-ndk-r16b/build/tools/make_standalone_toolchain.py --arch arm --api 14 --stl gnustl --install-dir=/opt/android-14-toolchain
Toolchain installed to /opt/android-14-toolchain.

toolchain 환경설정

$ echo 'export TOOLCHAIN=/opt/android-14-toolchain' | tee -a ~/.bashrc
$ echo 'export PATH=$TOOLCHAIN/bin:$PATH' | tee -a ~/.bashrc
$ echo 'export CC=arm-linux-androideabi-gcc' | tee -a ~/.bashrc

예제

Android.mk

LOCAL_PATH := $(call my-dir)
 
include $(CLEAR_VARS)
 
LOCAL_MODULE    := hello-jni
LOCAL_SRC_FILES := hello-jni.c
 
include $(BUILD_SHARED_LIBRARY)

hello-jni.c

#include <string.h>
#include <jni.h>

JNIEXPORT jstring JNICALL
Java_com_example_hellojni_HelloJni_stringFromJNI( JNIEnv* env,
                                                  jobject thiz )
{
#if defined(__arm__)
    #if defined(__ARM_ARCH_7A__)
    #if defined(__ARM_NEON__)
      #if defined(__ARM_PCS_VFP)
        #define ABI "armeabi-v7a/NEON (hard-float)"
      #else
        #define ABI "armeabi-v7a/NEON"
      #endif
    #else
      #if defined(__ARM_PCS_VFP)
        #define ABI "armeabi-v7a (hard-float)"
      #else
        #define ABI "armeabi-v7a"
      #endif
    #endif
  #else
   #define ABI "armeabi"
  #endif
#elif defined(__i386__)
#define ABI "x86"
#elif defined(__x86_64__)
#define ABI "x86_64"
#elif defined(__mips64)  /* mips64el-* toolchain defines __mips__ too */
#define ABI "mips64"
#elif defined(__mips__)
#define ABI "mips"
#elif defined(__aarch64__)
#define ABI "arm64-v8a"
#else
#define ABI "unknown"
#endif

    return (*env)->NewStringUTF(env, "Hello from JNI !  Compiled with ABI " ABI ".");
}

컴파일

$ ndk-build NDK_PROJECT_PATH=`pwd` APP_BUILD_SCRIPT=Android.mk
Android NDK: APP_PLATFORM not set. Defaulting to minimum supported version android-14.    
[arm64-v8a] Compile        : hello-jni <= hello-jni.c
[arm64-v8a] SharedLibrary  : libhello-jni.so
[arm64-v8a] Install        : libhello-jni.so => libs/arm64-v8a/libhello-jni.so
[armeabi-v7a] Compile thumb  : hello-jni <= hello-jni.c
[armeabi-v7a] SharedLibrary  : libhello-jni.so
[armeabi-v7a] Install        : libhello-jni.so => libs/armeabi-v7a/libhello-jni.so
[x86] Compile        : hello-jni <= hello-jni.c
[x86] SharedLibrary  : libhello-jni.so
[x86] Install        : libhello-jni.so => libs/x86/libhello-jni.so
[x86_64] Compile        : hello-jni <= hello-jni.c
[x86_64] SharedLibrary  : libhello-jni.so
[x86_64] Install        : libhello-jni.so => libs/x86_64/libhello-jni.so

Java 사용 예제

package com.example.hellojni;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;

public class HelloJni extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_hello_jni);
        TextView tv = (TextView)findViewById(R.id.hello_textview);
        tv.setText( stringFromJNI() );
    }
 
    public native String  stringFromJNI();

    public native String  unimplementedStringFromJNI();

    static {
        System.loadLibrary("hello-jni");
    }
}

Google 도메인 용 DDclient DyDNS 구성

OS/Linux 2019.01.26 11:13 Posted by 파란크리스마스

출처

DDclient 설치

$ sudo apt-get update
$ sudo apt-get install ddclient

DDclient 설정

$ sudo vi /etc/ddclient.conf

ddclient.conf 내용

# Configuration file for ddclient generated by debconf
#
# /etc/ddclient.conf

ssl=yes
#protocol=dyndns2
protocol=googledomains
use=web
server=domains.google.com
login=XXXXXXXXXXXXXXXXXXXXXXX
password='XXXXXXXXXXXXXXXXXXXXXXX'
www.XXXXXXXX.biz
daemon=100

DDclient 데몬 설정

$ sudo vi /etc/default/ddclient

ddclient 내용

run_daemon="true"
daemon_interval="300"

DDclient 서비스 등록

$ sudo systemctl enable ddclient
ddclient.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable ddclient
$ sudo systemctl start ddclient
$ sudo systemctl status ddclient
● ddclient.service - LSB: Update dynamic domain name service entries
   Loaded: loaded (/etc/init.d/ddclient; generated)
   Active: active (running) since Wed 2019-01-23 00:28:19 KST; 11min ago
     Docs: man:systemd-sysv-generator(8)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/ddclient.service
           └─1219 ddclient - sleeping for 250 seconds
 
 1월 23 00:28:19 bluesanta-desktop systemd[1]: Starting LSB: Update dynamic domain name service entries...
 1월 23 00:28:19 bluesanta-desktop systemd[1]: Started LSB: Update dynamic domain name service entries.

Ubuntu 18.04 : MariaDB 10.3.12 컴파일, 설치

Database 2019.01.26 10:50 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

MySQL 계정 만들기

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

cmake 설치

$ sudo apt-get install cmake

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

$ wget https://downloads.mariadb.org/interstitial/mariadb-10.3.12/source/mariadb-10.3.12.tar.gz
$ tar xvf mariadb-10.3.12.tar.gz
$ cd mariadb-10.3.12/
$ sudo cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mariadb103 \
-DMYSQL_DATADIR=/usr/local/mariadb103/data \
-DMYSQL_UNIX_ADDR=/usr/local/mariadb103/mysql.sock \
-DSYSCONFDIR=/usr/local/mariadb103 \
-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/mariadb103/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

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

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

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

$ cd /usr/local/mariadb103
$ scripts/mysql_install_db --no-defaults --user=mysql --datadir=/usr/local/mariadb103/data --basedir=/usr/local/mariadb103 -v
Installing MariaDB/MySQL system tables in '/usr/local/mariadb103/data' ...
OK
 
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
 
 
PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
To do so, start the server, then issue the following commands:
 
'/usr/local/mariadb103/bin/mysqladmin' -u root password 'new-password'
'/usr/local/mariadb103/bin/mysqladmin' -u root -h bluesanta-desktop password 'new-password'
 
Alternatively you can run:
'/usr/local/mariadb103/bin/mysql_secure_installation'
 
which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.
 
See the MariaDB Knowledgebase at http://mariadb.com/kb or the
MySQL manual for more instructions.
 
You can start the MariaDB daemon with:
cd '/usr/local/mariadb103' ; /usr/local/mariadb103/bin/mysqld_safe --datadir='/usr/local/mariadb103/data'
 
You can test the MariaDB daemon with mysql-test-run.pl
cd '/usr/local/mariadb103/mysql-test' ; perl mysql-test-run.pl
 
Please report any problems at http://mariadb.org/jira
 
The latest information about MariaDB is available at http://mariadb.org/.
You can find additional information about the MySQL part at:
http://dev.mysql.com
Consider joining MariaDB's strong and vibrant community:
https://mariadb.org/get-involved/

root 암호 초기화

$ bin/mysqld_safe --skip-grant-tables &
[1] 11396
mysql@bluesanta-desktop:/usr/local/mariadb103$ 190122 23:11:49 mysqld_safe Logging to '/usr/local/mariadb103/data/bluesanta-desktop.err'.
190122 23:11:49 mysqld_safe Starting mysqld daemon with databases from /usr/local/mariadb103/data

mysql@bluesanta-desktop:/usr/local/mariadb103$ bin/mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 10.3.12-MariaDB-log Source distribution

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

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

MariaDB [(none)]> 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
MariaDB [mysql]> update user set authentication_string = password('sqldba') where user = 'root';
Query OK, 4 rows affected (0.001 sec)
Rows matched: 4  Changed: 4  Warnings: 0

MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.000 sec)

MariaDB [mysql]> quit
Bye

mariadb 서비스 등록

서비스 mariadb 파일 복사

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

mariadb 수정

$ sudo vi /etc/init.d/mariadb

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

basedir=/usr/local/mariadb103
datadir=/usr/local/mariadb103/data

  # Try to find basedir in /etc/my.cnf
  conf=/usr/local/mariadb103/my.cnf

mariadb 서비스 등록

$ sudo update-rc.d mariadb defaults

mariadb 서비스 실행

$ sudo systemctl start mariadb.service
$ sudo systemctl status mariadb.service
● mariadb.service - LSB: start and stop MariaDB
   Loaded: loaded (/etc/init.d/mariadb; generated)
   Active: active (running) since Tue 2019-01-22 22:59:51 KST; 11s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 10984 ExecStart=/etc/init.d/mariadb start (code=exited, status=0/SUCCESS)
    Tasks: 32 (limit: 4915)
   CGroup: /system.slice/mariadb.service
           ├─11058 /bin/sh /usr/local/mariadb103/bin/mysqld_safe --datadir=/usr/local/mariadb103/data --pid-file=/us
           └─11191 /usr/local/mariadb103/bin/mysqld --basedir=/usr/local/mariadb103 --datadir=/usr/local/mariadb103/
 
 1월 22 22:59:50 bluesanta-desktop systemd[1]: Starting LSB: start and stop MariaDB...
 1월 22 22:59:50 bluesanta-desktop mariadb[10984]: Starting MariaDB
 1월 22 22:59:50 bluesanta-desktop mariadb[10984]: .190122 22:59:50 mysqld_safe Logging to '/usr/local/mariadb103/da
 1월 22 22:59:50 bluesanta-desktop mariadb[10984]: 190122 22:59:50 mysqld_safe Starting mysqld daemon with databases
 1월 22 22:59:51 bluesanta-desktop mariadb[10984]:  *
 1월 22 22:59:51 bluesanta-desktop systemd[1]: Started LSB: start and stop MariaDB.

mariadb 서비스 종료

$ sudo systemctl stop mariadb.service

사용자 추가

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

DB 종속적 사용자 추가

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

Ubuntu 18.04 LTS원격데스크톱 서비스(xRDP) 설치

OS/Linux 2019.01.26 10:28 Posted by 파란크리스마스

출처

설치

$ sudo apt-get install xrdp xorgxrdp

서비스 등록

$ sudo systemctl enable xrdp
Synchronizing state of xrdp.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable xrdp

Authenticate 팝업창 제거

sudo bash -c "cat >/etc/polkit-1/localauthority/50-local.d/45-allow.colord.pkla" <<EOF
[Allow Colord all Users]
Identity=unix-user:*
Action=org.freedesktop.color-manager.create-device;org.freedesktop.color-manager.create-profile;org.freedesktop.color-manager.delete-device;org.freedesktop.color-manager.delete-profile;org.freedesktop.color-manager.modify-device;org.freedesktop.color-manager.modify-profile
ResultAny=no
ResultInactive=no
ResultActive=yes
EOF

Tweak-tool을 설치

$ sudo apt-get install -y gnome-tweak-tool

micro:bit - L298N 이용 RC카 만들기(라디오통신)

OS/micro:bit 2019.01.05 23:54 Posted by 파란크리스마스

본 체험 제품은 아이씨뱅큐㈜ 에서 진행하는 무상 체험단 활동으로 작성한 것입니다.


출처

L298N DC모터 드라이버 스테핑모터

아두이노나 라즈베리파이를 이용해서 RC카를 만들때 사용했던 L298N 모터 드라이버를 micro:bit로 RC카를 만들어 보았습니다.
L298N 모터 드라이버를 저는 좋아하는데, 좌우 모터를 각각 앞뒤로 회전 시킬 수 있고, 좌우 각각 모터의 회전 속도도 정할 수 있으며,
최대의 장점으로는 가격이 저렴하고, 관련 자료가 많아 구현이 어렵지 않습니다.

무선 송수신 방식

무선 송수신 방식은 처음에는 BLE를 이용해서 핸드폰으로 구현 하려고 했는데,C언어로 구현할때는 간단하던 것이
블럭코딩에서 BLE방식으로 문자열 주고 받는 예제를 찾을 수 없어서, 라이브러리를 만들까 햇지만, 작업량이 너무 많아져서 BLE방식은 포기하고 라디오 송수신 방식을 이용했습니다.

전면 LED 화면 끄기

확장 보드를 사용하면서 주의 해야 될 점은 전면 LED 화면을 끄지 않으면, LED 핀과 충돌하여 정상적으로 동작하지 않는 다는 점인데,
C 언어를 사용할때는 기본적으로 껴져 있는데, 블럭코딩에서는 기본적으로 활성화 되어 있으므로, LED를 사용하지 않는 다면 LED 화면을 비활성화 시켜두는 것이 오동작을 막을 수가 있습니다.

LED를 사용해야 한다면 LED 제어 핀번호와 충돌이 발생하지 않는지 확인 해보고 구현해야 됩니다.

RC카 송신기

송신기(RC카 컨트롤러)는 지니어스 엣지보드와 호환 되는 조이스틱을 이용했습니다.

RC카 수신기

실행 영상


마이크로비트 지니어스키트 공식 구입처 : 아이씨뱅큐 http://www.icbanq.com/
아이씨뱅큐 공식 카페 : http://cafe.naver.com/icbanq
아이씨뱅큐 공식 블로그 : http://blog.naver.com/icbanq
마이크로비트 공식 카페 : http://cafe.naver.com/bbcmicro
나도메이커 유튜브 채널 : https://www.youtube.com/user/ICbanQ