。゚(*´□`)゚。

코딩의 즐거움과 도전, 그리고 일상의 소소한 순간들이 어우러진 블로그

[네이버클라우드] 클라우드 기반의 개발자 과정 7기/리눅스

4-1 Ubuntu linux 설치

quarrrter 2023. 4. 27. 20:18

1. 설치


Ubuntu linux 설치
가상머신 이름: MyUbuntuLinux
RAM: 2G, HDD: 30G
preocessor: 2개
Hostname: psh

일반 사용자 j, pwd: j
비밀번호 변경 : #passwd jj, jj

파티션 계획 (윈도우 식이면 c, d, e ,,, )
/boot 1G
swap  2G
/     12G
/home 5G
/data 나머지

네트워크/advanced / 포트포워딩: 22 80 8000 8080
저장소 - 비어있음을 ubuntu로 설정

 

SSH 설정하기

 

2. 기본 패키지 설치 + 환경 설정 (alias 등)

 


sudo -i   // 슈퍼유저 지금 사용잔데 루트로 로그인 시키는 키 
alias ai='apt -y install'



mkdir /yes
mount -t vboxsf win /yes  윈도우 마운트 win 폴더를 /yes 디렉토리로 마운트
nl mywin.txt     .txt 내용 읽기
cat > lunux.txt             lunux텍스트 파일 추가 (현재 /yes 폴더에)
cp -r /etc /yes /yes 디렉토리에 /etc 복사하기 


**alias 설치
 vi ~/.bashrc

alias h='history'
alias l='ls -AlF'
alias c='clear'
alias cp='cp -i'
alias mv='mv -i'
alias df='df -h'
alias du='du -sh'
alias li='ls -Ali'
alias lh='ls -Alh'

alias ai='apt -y install'
alias dq='dnf list --installed | grep '
alias dc='dnf list --installed | wc -l'


**vimrc 넣기
 vi ~/.vimrc
  se nu ai ci si ts=4 sw=4 ruler title showmatch
  syntax on
  hi comment ctermfg=red

  ab P printf(" ");
  ab J System.out.println(" ");


**필요한 package 설치 

ai gcc g++ default-jdk mysql-server apache2 mandoc sqlite3 rdate rename tree mailutils lynx tomacat9 glibc-doc



ai gcc g++ default-jdk mysql-server apache2 \
> mandoc sqlite3 rdate rename \
>tree mailutils lynx tomacat9 glibc-doc

 

 


**sudo -i   // 슈퍼유저 지금 사용잔데 루트로 로그인 시키는 키 
alias ai='apt -y install'

 

**윈도우 마운트

mkdir /yes
mount -t vboxsf win /yes  윈도우 마운트 win 폴더를 /yes 디렉토리로 마운트
nl mywin.txt     .txt 내용 읽기
cat > lunux.txt             lunux텍스트 파일 추가 (현재 /yes 폴더에)
cp -r /etc /yes /yes 디렉토리에 /etc 복사하기 

 

**alias 설치
 vi ~/.bashrc

alias h='history'
alias l='ls -AlF'
alias c='clear'
alias cp='cp -i'
alias mv='mv -i'
alias df='df -h'
alias du='du -sh'
alias li='ls -Ali'
alias lh='ls -Alh'

alias ai='apt -y install'
alias dq='dnf list --installed | grep '
alias dc='dnf list --installed | wc -l'

 

**필요한 package 설치 
ai gcc g++ default-jdk mysql-server apache2 mandoc sqlite3 rdate rename tree mailutils lynx tomacat9 glibc-doc

 

*줄이 길 때 : 백틱이랑 > 사용하기

ai gcc g++ default-jdk mysql-server apache2 \
> mandoc sqlite3 rdate rename \
>tree mailutils lynx tomacat9 glibc-doc


mysql 하기 

 

root 에서 

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> alter user root@localhost identified \                mysql 비번 바꿈
    -> with mysql_native_password by 'jj'
    -> ;
Query OK, 0 rows affected (0.01 sec)

mysql> create user myk2@localhost identified \                 mysql myk2 계정을 만듬
    -> with mysql_native_password by 'j';
Query OK, 0 rows affected (0.01 sec)

mysql> grant all privileges on k2DB.* to myk2@localhost;          k2DB에 대해 모든 권한 허용
Query OK, 0 rows affected (0.01 sec)

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



k2에서
k2@psh:~$ mysql -u myk2 -p
비번 입력 j 접속 ~ 


mysql> create database k2DB
    -> ;
Query OK, 1 row affected (0.00 sec)

mysql> use k2DB
Database changed
mysql> show table;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1


mysql> create table Man(
    -> name char(20),
    -> age int);
Query OK, 0 rows affected (0.01 sec)

mysql> insert into Man values('손흥민', 32);
Query OK, 1 row affected (0.01 sec)

mysql> insert into Man values('이강인', 25);
Query OK, 1 row affected (0.01 sec)

mysql> select * from Man;
+-----------+------+
| name      | age  |
+-----------+------+
| 손흥민    |   32 |
| 이강인    |   25 |
+-----------+------+
2 rows in set (0.00 sec)