2016. 5. 4. 16:41

1. mysql이 설치되어 있는지 검색해보자!

$ dpkg -l | grep mysql-server


2. mysql 설치

$ sudo apt-get install mysql-server





'Tip > 우분투' 카테고리의 다른 글

mac의 terminal에서 ssh로 Ubuntu로 접속시에 한글 깨짐현상  (0) 2015.11.19
Ununbu에 vsftpd 설치하기  (0) 2015.04.14
MySQL 기본적인 사용  (0) 2014.11.19
MySQL 원격접속 허용하기  (0) 2014.11.19
MySQL 접속  (0) 2014.11.19
Posted by 모바일헌터
2015. 11. 19. 12:57
mac의 terminal에서 ssh로 Ubuntu로 접속시에 한글 깨짐현상 (Mac과 Ubuntu에서 모두 셋팅을 해줘야 한다.)

1. 한글 보기 문제 

locale 설정을 mac은 접속하는 터미널에서 실행, ubuntu는 ~/.bash_profile에 아래의 2줄을 추가하였다.

export LANG=’ko_KR.UTF-8′

export LC_ALL=’ko_KR.UTF-8′


2. 한글 입력 문제

mac은 접속하는 터미널에서 실행, ubuntu는 ~/.inputrc 파일에 아래 3줄을 추가하였다.

set convert-meta off

set meta-flag on

set output-meta on


3.vi 에서 한글이 깨질 경우

ubuntu에만 ~/.vimrc 파일에 아래 2줄을 추가하였다.

set encoding=utf-8

setfileencodings=utf-8,euckr

'Tip > 우분투' 카테고리의 다른 글

ubuntu mysql 설치  (0) 2016.05.04
Ununbu에 vsftpd 설치하기  (0) 2015.04.14
MySQL 기본적인 사용  (0) 2014.11.19
MySQL 원격접속 허용하기  (0) 2014.11.19
MySQL 접속  (0) 2014.11.19
Posted by 모바일헌터
2015. 4. 14. 11:58

1. 설치되어 있는 vsftpd확인하기

$ dpkg -l | grep vsftpd


2. 설치되어 있지 않다면 vsftpd를 설치하기

$ sudo apt-get install vsftpd


3. ssh 포트 변경하기

$ sudo vi /etc/vsftpd.conf


anonymouse_enable=NO

write_enable=YES

xferlog_file=/var/log/vsftpd.log

4. 재실행하기

$ sudo service vsftpd restart




'Tip > 우분투' 카테고리의 다른 글

ubuntu mysql 설치  (0) 2016.05.04
mac의 terminal에서 ssh로 Ubuntu로 접속시에 한글 깨짐현상  (0) 2015.11.19
MySQL 기본적인 사용  (0) 2014.11.19
MySQL 원격접속 허용하기  (0) 2014.11.19
MySQL 접속  (0) 2014.11.19
Posted by 모바일헌터
2014. 11. 19. 10:10


Database

- 데이터베이스 보기

 mysql> show databases;


- 데이터베이스 생성

 mysql> create database {databases-name};

예) create database openfire;

- 데이터베이서 삭제

 mysql> drop database {databases-name};

예) drop database openfire;

Table
- 테이블 보기

 mysql> show tables;


'Tip > 우분투' 카테고리의 다른 글

mac의 terminal에서 ssh로 Ubuntu로 접속시에 한글 깨짐현상  (0) 2015.11.19
Ununbu에 vsftpd 설치하기  (0) 2015.04.14
MySQL 원격접속 허용하기  (0) 2014.11.19
MySQL 접속  (0) 2014.11.19
Openfire (XMPP) 설치  (1) 2014.11.19
Posted by 모바일헌터
2014. 11. 19. 10:10

- MySQL 설정변경
 $ sudo vi /etc/mysql/my.cnf
# bind-address=127.0.0.1
 $ sudo /etc/init.d/mysql restart
mysql은 기본적으로 127.0.0.1 (localhost)에서만 접속을 허용하며 client의 default port는 3306이다.
보안을 위해서 포트를 변경하고 bind-address라인을 #을 넣어 원격접속을 허용하고 mysql을 재 시작 해줘야 한다.

- root로 로그인하기
 $ mysql -u root -p mysql
+--------+-----------+
| user   | host      |
+--------+-----------+
| root   | 127.0.0.1 |
| root   | ::1       |
|        | localhost |
| com    | localhost |
| hyb    | localhost |
| mobile | localhost |
| root   | localhost |
+--------+-----------+
8 rows in set (0.00 sec)

mysql> insert into user (host, user, password, ssl_cipher, x509_issuer, x509_subject) values ('%','root',password('password'),'','','');

- 사용자 확인

mysql> select user, host from user;



- 사용자 권한 설정

mysql> GRANT all privileges on {database-name}.* to '{user-id}' identified by 'password';

mysql> GRANT all privileges on {database-name}.* to '{user-id}'@'localhostidentified by 'password';

예) grant all privileges on openfire.* to 'openfire'@'openfire-server' identified by 'openfire-password';

모든 데이터베이스에 대해서 권한을 부여하려고 할 경우 *를 사용한다. 특정 IP('111.112.113.114')를 지정할 수 있으며 만약 모든 IP를 허용하고 싶다면 '%', '111.112'로 시작하는 아이피를 허용하고 싶다면 '111.112.%'로  대체하면 된다.  hostname을 명시하지 않으면 '%'과 동일하며 localhost에서도 동작하기 위해서는 꼭 'localhost'를 따로 명시해주어야 한다.

select와 insert만 허용하는 경우 다음과 같이 설정할 수 있다.

mysql> GRANT select, insert on {database-name}.* to '{user-id}'@'localhostidentified by 'password';


- 사용자 권한 삭제

mysql> revoke all privileges on *.* from '{user-id}'@'{hostname}'


이제 원격에서 접속해보자.
$ mysql -h 111.111.111.111 -u root -p

접속 허용을 삭제해보자.

mysql>  delete from mysql.user where host='192.168.70.102' and user='root';
Query OK, 1 row affected (0.00 sec)



'Tip > 우분투' 카테고리의 다른 글

Ununbu에 vsftpd 설치하기  (0) 2015.04.14
MySQL 기본적인 사용  (0) 2014.11.19
MySQL 접속  (0) 2014.11.19
Openfire (XMPP) 설치  (1) 2014.11.19
ant를 ubuntu에 설치해봅시다.  (0) 2014.11.18
Posted by 모바일헌터
2014. 11. 19. 10:07
- MySQL 기본적인 사용



► mysql에 접속한 상태에서 mysql 데이터베이스를 사용하기 위하여 다음의 명령어를 사용합니다.

mysql -u root -p 

Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 37
Server version: 5.5.40-0ubuntu1 (Ubuntu)

Copyright (c) 2000, 2014, 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 -u root -p mysql"이라고 입력하여 한번에 처리도 가능합니다.


 변경 내용을 반영하기 위해서는 다음의 명령을 실행해야 합니다.

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



'Tip > 우분투' 카테고리의 다른 글

MySQL 기본적인 사용  (0) 2014.11.19
MySQL 원격접속 허용하기  (0) 2014.11.19
Openfire (XMPP) 설치  (1) 2014.11.19
ant를 ubuntu에 설치해봅시다.  (0) 2014.11.18
MySQL 유저관리  (0) 2014.11.12
Posted by 모바일헌터
2014. 11. 19. 00:40
Ubuntu에서 OpenFire를 설치해 보자!

1. Openfire를 다운로드 받기 [다운로드 사이트]
- openfire_src_{version}.tar.gz 를 다운로드 받으세요.자 

2. Java (JDK)가 설치가 되어 있어야만 합니다. 자신의 머신에 맞게 JDK를 설치해주세요.

3. Ant 빌드 툴 설치
ant를 ubuntu에 설치해봅시다. (굳이 ant를 설치하지 않아도 포함하고 있습니다.)

4. 컴파일 & 설치 & 실행
$ tar xvfz openfire_src_3_9_3.tar.gz
$ cd openfire_src/build
$ ant
$ mv ../target/openfire /opt/.
$ cd /opt/openfire/bin
$ sudo ./openfire.sh or $ sudo ./openfirectl

5. 설정
http://localhost:9090 or http://{domain-name}:9090
브라우져에서 서버가 설치된 컴퓨터의 9090포트로 접속을 하여 설정을 진행하자.

5.1 Choose Language
  - English 선택 (안타깝게도 아직 한국어는 지원하지 않는다)

5.2 Server Settings: 
  - 도메인 명만 분명히 입력해주시면 됩니다. (같은 컴퓨터에서 진행할 경우 localhost를 다른 컴퓨터를 사용할 경우 적당한 도메인 명을 입력해주면되며 /etc/hosts 파일을 수정하여 테스트를 진행할 수도 있다.)
  - 접속 포트를 수정해줄 수 있다.

5.3 Database Settings
  - Standard Database Connection

5.4 Database Settings - Standard Connection
  - jdbc:mysql://localhost:3306/openfire?rewriteBatchedStatements=true
  - mysql에 database와 user를 미리 Openfire 서버로부터 사용할 수 있는 권한을 주어야 한다.
    (참조 
http://www.mobilehunter.net/105)
예) mysql > create user 'openfire'@'localhost' identified by 'openfire-password';
     mysql > create database openfire;
     mysql > grant all privileges on openfire.* to 'openfire'@'localhost' identified by 'openfire-password';

5.5 Profile Settings
  - Default를 설정하자.

5.6 Administrator Account
  - email과 password를 설정하자

6. admin 접속
username은 admin이다. 
(Administrator Account설정시 email을 입력하였다고 해서 email을 입력하면 안된다. 하지만 password는 Administrator Account 설정 시 입력한 password이다.)

7. openfirectl 설정

### BEGIN INIT INFO
# Provides:          openfire
# Required-Start:    $local_fs $remote_fs $network
# Required-Stop:     $local_fs $remote_fs $network
# Should-Start:      $named
# Should-Stop:       $named
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start openfire
# Description:       Start the openfire engine.
### END INIT INFO
...
[ -z "$OPENFIRE_USER" ] && OPENFIRE_USER="root"
...
start() {
        # Start daemons.
        echo "Starting openfire: "
        PID=`su - $OPENFIRE_USER -c "nohup $OPENFIRE_RUN_CMD > $OPENFIRE_LOGDIR/nohup.out 2>&1 &"`
        RETVAL=$?

        OPENFIRE_PID=`ps -U $OPENFIRE_USER  -o pid,cmd --no-heading | grep 'DopenfireHome' | grep -v "grep"  | cut -d " " -f 2`
        echo $OPENFIRE_PID >  $OPENFIRE_PIDFILE

        [ $OPENFIRE_PID -gt 0 -a -d /var/lock/subsys ] && touch /var/lock/subsys/openfire

        sleep 1 # allows prompt to return
}

약간의 수정을 하셔야만 Ubuntu에서 정상동작 합니다.
$ sudo cp /opt/openfire/bin/openfirectl /etc/init.d/.
sudo update-rc.d openfirectl defaults




'Tip > 우분투' 카테고리의 다른 글

MySQL 원격접속 허용하기  (0) 2014.11.19
MySQL 접속  (0) 2014.11.19
ant를 ubuntu에 설치해봅시다.  (0) 2014.11.18
MySQL 유저관리  (0) 2014.11.12
Ubuntu의 명령라인에서 패키지 관리  (0) 2014.11.11
Posted by 모바일헌터
2014. 11. 18. 22:51
0. 간단한 설치
$ sudo apt-get install ant


1. Ant 다운로드
Ant Apache 사이트에서 소스를 다운로드 해주세요.
apache-ant-{version}-src.tar.gz

$ wget http://www.webhostingjams.com/mirror/apache//ant/source/apache-ant-1.9.4-src.tar.gz


2. md5 확인

$ md5sum apache-ant-1.9.4-src.tar.gz
5beb7949f8c4eff84b20b55c795de0a4  apache-ant-1.9.4-src.tar.gz

5beb7949f8c4eff84b20b55c795de0a4


3. ant 설치

$ tar xvfz apache-ant-1.9.4-src.tar.gz
$ cd  apache-ant-1.9.4 
$ sudo sh build.sh -Ddist.dir=/usr/share/ant dist 


4. link 설치
sudo update-alternatives --install /usr/bin/ant ant /usr/share/ant/bin/ant 1 \
--slave /usr/bin/ant-bins ant-bins /usr/share/ant/bin/ant-bins

► 참고
- JUnit 사이트를 방문하여 hamcrest-core.jar 다운로드 받아서 "lib/optional” 에 카피해준다.
$ cd lib/optional
$ wget -O hamcrest-core-1.3.jar http://search.maven.org/remotecontent?filepath=org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar







'Tip > 우분투' 카테고리의 다른 글

MySQL 접속  (0) 2014.11.19
Openfire (XMPP) 설치  (1) 2014.11.19
MySQL 유저관리  (0) 2014.11.12
Ubuntu의 명령라인에서 패키지 관리  (0) 2014.11.11
Ubuntu Server에 tomcat 설치  (0) 2014.11.10
Posted by 모바일헌터
2014. 11. 12. 13:10


유저 관리

- create user 문 사용 (유저추가-1)

 mysql> create user '{user-id}'@'{hostname}' identified by '{user-password}';

예) create user 'openfire'@'openfire-server' identified by 'openfire-password';
⦿ '{hostname}'은 'localhost' 로컬접근을 허용하고 '%' 모든 외부접근을 허용하며 특정 IP에서만 접속을 할 수 있도록 지정할 수 있다. 

- insert 문 사용 (유저추가-2)

 mysql> insert into user(host, user, password) values('{hostname}', '{user-id}', password('{new-password}'));


- drop user 문 사용  (유저삭제-1)

 mysql> drop user '{user-id}';  혹은  mysql> drop user '{user-id}'@'{hostname}';

⦿ 같은 user-id로 여러 개의 hostname이 등록될 수 있으므로 각

- delete
 문 사용 
(유저삭제-2)

 mysql> delete from user where user = '{user-id}';
혹은 
 
mysql> delete from user where user = '
{user-id}', host = '{hostname}';


- mysqladmin 이용 (패스워드 변경-1)
 $ mysqladmin -u {user-id} -p password {new-password}
Enter password: {old-password}

- update문 이용  (패스워드 변경-2)
 mysql> update user set password = password('{new-password}') where user = {user-id};

- set password문 이용  (패스워드 변경-3)

 mysql> set password for {user-id} = password('{new-password}') ;






'Tip > 우분투' 카테고리의 다른 글

Openfire (XMPP) 설치  (1) 2014.11.19
ant를 ubuntu에 설치해봅시다.  (0) 2014.11.18
Ubuntu의 명령라인에서 패키지 관리  (0) 2014.11.11
Ubuntu Server에 tomcat 설치  (0) 2014.11.10
Ubuntu Server에 Apache httpd 설치하기  (0) 2014.11.10
Posted by 모바일헌터
2014. 11. 11. 23:35

- 설치 가능한 패키지들의 리스트 갱신: $ sudo apt-get update

- 레파지토리로 부터 패키지 설치: $ sudo apt-get install [package_name]
- 파일 부터 패키지 설치: $ sudo apt-get install [package.deb]
- 패키지 제거: $ sudo apt-get remove [pakcage_name]
- 패키지 제거(설정파일 포함): $ sudo apt-get purge [package_name] 

Ubuntu에서 서비스를 관리하는 방법
- 서비스를 시작 $ sudo service {service-name} start   $ sudo invoke-rc.d {service-name} start    $ sudo /etc/init.d/{service-name} start
- 서비스를 종료 $ sudo service {service-name}stop   $ sudo invoke-rc.d {service-name} stop    $ sudo /etc/init.d/{service-name} stop

- 부팅시 서비스를 자동 시작 Enabling $ sudo update-rc.d {service-name} defaults
- 부팅시 서비스를 자동 시작 Disabling $ sudo update-rc.d {service-name} remove

◎ chkconfig, sysv-rc-conf, sysvconfig를 설치하고 설정하는 방법도 있으나 "update-rc.d”를 이용하시길 권한다.

'Tip > 우분투' 카테고리의 다른 글

ant를 ubuntu에 설치해봅시다.  (0) 2014.11.18
MySQL 유저관리  (0) 2014.11.12
Ubuntu Server에 tomcat 설치  (0) 2014.11.10
Ubuntu Server에 Apache httpd 설치하기  (0) 2014.11.10
Ubuntu Server에 GNU GCC컴파일러 설치  (0) 2014.11.10
Posted by 모바일헌터