DataBase server
Mysql 설치
root@ysy:~# ai mysql-server --> ai 의 alias apt -y install
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
mysql-server is already the newest version (8.0.32-0ubuntu4).
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
--> mysql 이미 설치된 상태
root@ysy:~# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.32-0ubuntu4 (Ubuntu)
Copyright (c) 2000, 2023, Oracle and/or its affiliates.
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> exit
Bye
--> root 에서 정상 작동 확인
사용자 생성
root@ysy:~# useradd gold
root@ysy:~# passwd gold
New password:
Retype new password:
passwd: password updated successfully
실제 사용
root 에서 설정
root@ysy:~# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.32-0ubuntu4 (Ubuntu)
Copyright (c) 2000, 2023, Oracle and/or its affiliates.
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>
mysql> alter user root@localhost identified
-> with mysql_native_password by 'jj';
Query OK, 0 rows affected (0.00 sec)
mysql> create user mygold@localhost identified
-> with mysql_native_password by 'j';
Query OK, 0 rows affected (0.00 sec)
mysql> grant all privileges on goldDB.* to mygold@localhost;
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye
gold 로 로그인 하여 사용
gold@ysy:~$ mysql -u mygold -p
Enter password: --> 설정해줬던 비밀번호 입력 : j
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.32-0ubuntu4 (Ubuntu)
Copyright (c) 2000, 2023, Oracle and/or its affiliates.
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> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| performance_schema |
+--------------------+
2 rows in set (0.01 sec)
mysql> create database goldDB;
Query OK, 1 row affected (0.01 sec)
mysql> use goldDB;
Database changed
mysql> show tables;
Empty set (0.00 sec)
mysql> exit
Bye
Tomcat 연동 설치
root@ysy:~# ai tomcat9 tomcat9-examples tomcat9-admin tomcat9-docs
Tomcat 실행 확인
root@ysy:~# ps -ef | grep tomcat --> 톰캣 실행 확인
tomcat 625 1 0 14:19 ? 00:00:13 /usr/lib/jvm/default-java/bin/jaava.util.logging.config.file=/var/lib/tomcat9/conf/logging.properties -Djava.util.lomanager=org.apache.juli.ClassLoaderLogManager -Djava.awt.headless=true -Djdk.tls.ephDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dorg.acatalina.security.SecurityListener.UMASK=0027 -Dignore.endorsed.dirs= -classpath /use/tomcat9/bin/bootstrap.jar:/usr/share/tomcat9/bin/tomcat-juli.jar -Dcatalina.base=/b/tomcat9 -Dcatalina.home=/usr/share/tomcat9 -Djava.io.tmpdir=/tmp org.apache.catalirtup.Bootstrap start
root 5011 2583 0 16:32 pts/4 00:00:00 grep --color=auto tomcat
root@ysy:~# ps -ef | grep apache2 --> 아파치 실행 확인
root 4501 1221 0 15:54 pts/2 00:00:00 vi apache2.conf
root 4519 1 0 16:00 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 4520 4519 0 16:00 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 4521 4519 0 16:00 ? 00:00:00 /usr/sbin/apache2 -k start
root 5013 2583 0 16:33 pts/4 00:00:00 grep --color=auto apache2
root@ysy:~# systemctl stop apache2 --> 아파치 끄기
root@ysy:~# systemctl restart tomcat9 --> 톰캣 재시작
root@ysy:~# systemctl start apache2 --> 아파치 시작
ln -s /etc/apache2/mods-available/userdir.conf
ln -s /etc/apache2/mods-available/userdir.conf
root@ysy:~# cd /etc/apache2/
root@ysy:/etc/apache2# ls
apache2.conf conf-enabled magic mods-enabled sites-available
conf-available envvars mods-available ports.conf sites-enabled
root@ysy:~# cd /etc/apache2/mods-enabled/
root@ysy:/etc/apache2/mods-enabled# ln -s ../mods-available/userdir.conf
root@ysy:/etc/apache2/mods-enabled# ln -s ../mods-available/userdir.load
--> 해당 링크 생성 시 사용자들도 웹사이트를 만들 수 있음
gold 로그인
gold@ysy:~$ mkdir public_html
gold@ysy:~$ echo "my name is gold..." > public_html/index.html --> public_html 에 index.html 생성
gold@ysy:~$ chmod 755 ~ --> 권한 주기
root 로그인
root@ysy:/etc/apache2/mods-enabled# systemctl restart apache2 --> 아파치 재시작
gold가 생성한 index.html => 웹브라우저 127.0.0.1/~gold/ 에서 확인 가능
워드프레스 사용해보기
php 설치
root@ysy:/var/www/html# ai php
root@ysy:/var/www/html/wp# systemctl restart tomcat9
root@ysy:/var/www/html/wp# systemctl restart apache2
php 관련 파일 설치
ai php php-curl php-gd php-intl php-mbstring php-soap php-xml \
php-xmlrpc php-zip php-mysql apache2 mysql-server
wget 이용하여 워드프레스 다운로드
워드프레스 다운로드 링크
ㄴ https://ko.wordpress.org/download/
ㄴ 다운로드 링크 우클릭 > 링크 주소 복사
root@ysy:/var/www/html# wget https://ko.wordpress.org/latest-ko_KR.tar.gz
ㄴ wget 이용하여 파일 다운로드
root@ysy:/var/www/html# tar xf latest-ko_KR.tar.gz
root@ysy:/var/www/html# ls
d5 icons latest-ko_KR.tar.gz old.html wordpress
root@ysy:/var/www/html# mv wordpress/ wp --> 이름 단순하게 만들기
root@ysy:/var/www/html# ls
d5 icons latest-ko_KR.tar.gz old.html wp
root@ysy:/var/www/html# cd wp/
root@ysy:/var/www/html/wp# ls
index.php wp-blog-header.php wp-includes wp-settings.php
license.txt wp-comments-post.php wp-links-opml.php wp-signup.php
readme.html wp-config-sample.php wp-load.php wp-trackback.php
wp-activate.php wp-content wp-login.php xmlrpc.php
wp-admin wp-cron.php wp-mail.php
root@ysy:/var/www/html/wp# cp wp-config-sample.php wp-config.php --> 이름 단순하게 만들기
root@ysy:/var/www/html/wp# vi wp-config.php
ㄴ wp-config.php 파일 변경
root@ysy:/var/www/html# systemctl restart apache2
ㄴ 설정 완료 후 재시작
root@ysy1:/var/www/html# vi b.php
ㄴ b.php 생성
ㄴhttp://127.0.0.1/b.php 확인
웹 브라우저 > 127.0.0.1
ㄴ wp/ 클릭
ㄴ 정보 입력 > [워드프레스 설치] 선택 --> 여기서 패스워드 복사해두기
ㄴ [로그인] 선택
ㄴ 정보 입력 > [로그인] 선택
ㄴ 완료!
'네이버클라우드 > Linux' 카테고리의 다른 글
Linux 8일차 (2023-05-03) Shell Script - 실습 (0) | 2023.05.03 |
---|---|
Linux 8일차 (2023-05-03) Shell Script (0) | 2023.05.03 |
Linux 7일차 (2023-05-02) Linux Network - Web server (0) | 2023.05.02 |
Linux 7일차 (2023-05-02) Linux Network - 윈도우 mount 복습 (0) | 2023.05.02 |
Linux 7일차 (2023-05-02) Linux Network - DNS Server (0) | 2023.05.02 |