Linux sinfo 5.4.0-135-generic #152-Ubuntu SMP Wed Nov 23 20:19:22 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

1.1
1.  swap(2,048)  -> 10,000
2.  /boot(100)   ->  2,000
3.  /(3,072)     -> 12,000
4.  /usr(8,192)  -> 70,000
5.  /usr2(90,000)-> 90,000
6.  /var(4,096)  -> 12,000
7.  /tmp(4,096)  -> 12,000
8.  /data(70,000)-> 70,000
9.  /home(2,000) ->  2,000
10. /web(나머지 부분을 할당, 체크)

2.1
sudo passwd root

3.2
userdel sinfo

groupadd other
useradd -d /usr2/sinfo -s /bin/bash -g other -m sinfo
passwd sinfo

4.1
$apt install telnetd -y
$systemctl status inetd

5.1
$apt-get install vsftpd
$systemctl restart vsftpd
$vi /etc/vsftpd.conf
/*------------------------------------
listen=NO
listen_ipv6=YES
anonymous_enable=NO
local_enable=YES
chroot_local_user=YES
allow_writeable_chroot=YES
local_root=/data/ftp/files
write_enable=YES
local_umask=022
dirmessage_enable=YES
userlist_enable=YES
userlist_file=/etc/vsftpd.userlist
userlist_deny=NO
------------------------------------*/
/*------------------------------------
write_enable=YES
write_enable=YES
write_enable=YES
write_enable=YES
------------------------------------*/
$systemctl restart vsftpd

6.1
$gcc --version
$apt update
$apt install build-essential

7. 원하는 버전의 gcc 설치
$apt -y install gcc-7 g++-7 gcc-8 g++-8 gcc-9 g++-9

8. gcc default 설정 (명령어 뒤 700, 800, 900은 임의 숫자 적용)

$update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 700
$update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 700 
$update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 800
$update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 800
$update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 900
$update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 900

9. default 설정 확인 및 변경
$update-alternatives --config gcc
$update-alternatives --config g++

root@sinfo:~# update-alternatives --config gcc
There are 3 choices for the alternative gcc (providing /usr/bin/gcc).

  Selection    Path            Priority   Status
------------------------------------------------------------
* 0            /usr/bin/gcc-9   900       auto mode
  1            /usr/bin/gcc-7   700       manual mode
  2            /usr/bin/gcc-8   800       manual mode
  3            /usr/bin/gcc-9   900       manual mode

Press <enter> to keep the current choice[*], or type selection number: 1
update-alternatives: using /usr/bin/gcc-7 to provide /usr/bin/gcc (gcc) in manual mode


root@sinfo:~# update-alternatives --config g++
There are 3 choices for the alternative g++ (providing /usr/bin/g++).

  Selection    Path            Priority   Status
------------------------------------------------------------
* 0            /usr/bin/g++-9   900       auto mode
  1            /usr/bin/g++-7   700       manual mode
  2            /usr/bin/g++-8   800       manual mode
  3            /usr/bin/g++-9   900       manual mode

Press <enter> to keep the current choice[*], or type selection number: 1
update-alternatives: using /usr/bin/g++-7 to provide /usr/bin/g++ (g++) in manual mode

10.
source ~/.bash_profile
source ~/.bashrc

>등록
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-3.3
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.7
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9

>선택
update-alternatives --config g++ 

nohup 명령어는 리눅스에서 프로세스를 실행한 터미널의 세션 연결이 끊어지더라도 지속적으로 동작 할 수 있게 해주는 명령어입니다.

#create
alias exe='cd /usr2/sinfo/exe/'
alias shell='cd /usr2/sinfo/exe/shell'
alias src='cd /usr2/sinfo/src/'
alias log='cd /usr2/sweb/logs/receive/'
alias manage='cd /usr2/sweb/data/manage/'

source ~/.bashrc

etc>
-bash-3.00$ source .bashrc_backup
-bash: .bashrc_backup: line 7: syntax error: unexpected end of file


-bash-3.00$ file /home/www/work/.bashrc
/home/www/work/.bashrc: ASCII text, with CRLF line terminators



-bash-3.00$ perl -pi -e "s/\r//g" .bashrc
-bash-3.00$ file .bashrc
.bashrc: ASCII text
-bash-3.00$ source .bashrc


#delete
unalias exe
unalias shell
unalias src
unalias log
unalias manage

>>>>> .bashrc 와 .bash_profile 의 차이

1) bash 쉘(Shell) 이란?
쉘(Shell)은 운영체제에서 **사용자가 입력하는 명령을 읽고 해석하여 대신 실행해주는 프로그램**입니다. 
운영체제 상에서 다양한 운영체제 기능과 서비스를 구현하는 인터페이스를 제공하며, 사용자와 운영체제의 내부(커널)` 사이의 인터페이스를 감싸는 층이기 때문에 셸이라는 이름이 붙었습니다. 
쉘은 운영체제에서 필수적으로 존재합니다.

운영체제는 로그인한 사용자가 없다면 하나의 쉘도 실행되지 않은 상태이며, 
사용자가 로그인을 시도하면 운영체제는 ID와 패스워드를 받아들이는 로기은 프로그램을 실행하고, 
사용자가 입력한 ID와 패스워드를 검증한 후 인증된 사용자라면 쉘을 실행하여 사용자 세션을 쉘에게 전달합니다.

쉘의 역할은 사용자가 입력한 명령을 해석하여 대신 실행해주는 것입니다. 
쉘의 내부 명령어라면 스스로 실행한 뒤 화면에 표시해주고 내부 명령어가 아니라면 PATH 환경변수에 
지정된 경로에서 입력받은 명령과 같은 파일을 찾아 exec() 시스템콜을 호출하여 실행한 뒤 
키보드와 마우스 등의 입력장치와 모니터에 해당하는 표준 출력장치의 제어권을 해당 프로그램에 넘겨준 뒤 프로그램이 끝날 때 까지 대기하는 역할을 합니다.

bash 쉘은 유닉스에서 사용하는 커맨드 쉘의 일종으로 GNU 프로젝트를 위해 만들어졌습니다. 
초기의 유닉스 쉘인 본 쉘(Bourne Shell)과 새로 태어났다는 뜻의 영어 ‘born again’을 합쳐 **본 어게인 쉘(Bourne-again Shell)**이라고 불렸으나, 
일반적으로 bash로 줄여 부릅니다.

2) Login Shell 과 Non-Login Shell

Login Shell
Login은 ID와 패스워드를 입력해서 Shell을 실행하는 것을 말합니다. 따라서 ssh로 접속하거나 로컬에서 GUI를 통해 Shell을 실행하는 것은 Login Shell 입니다.
.profile, .bash_profile 이 두 파일은 Login할 때 로드되는 파일입니다. .profile은 꼭 bash가 아니더라도 로그인하면 로드되며, .bash_profile은 꼭 bash로 로그인 할 때만 실행됩니다.

Non-Login Shell
Non-Login Shell은 로그인 없이 실행하는 Shell을 말합니다. ssh로 접속하고 나서 다시 bash를 실행하는 경우나, GUI 세션에서 터미널을 띄우는 것도 여기 해당합니다. ‘sudo bash’나 ‘su’같은 것도 해당합니다.

.bashrc 와 .bash_profile 의 차이
.bashrc
이미 로그인 한 상태에서 새 터미널 창을 열 때마다 로드됩니다. (Non-Login Shell에서 실행됩니다.)

.bash_profile
시스템에 로그인할 때마다 로드됩니다. (Login Shell에서 실행됩니다.) 대부분 개별 사용자에 대한 설정에 대한 코드들이 들어갑니다. 예를 들면 nvm(Node Version Manager)은 기본적으로 nvm을 사용하지 않고 Node를 설치할 때와는 다르게 각 사용자의 경로에 설치되게 되는데, 이럴때 nvm의 PATH를 .bash_profile 파일에 기재합니다.

.profile
로그인할 때 로드됩니다. 개별 사용자에 대한 설정 코드들 중 bash와는 관계없는 부분을 기재합니다.

만약 Mac에서 새 터미널 창을 열 때마다 .bashrc를 로드하고 싶다면 .bash_profile에서 .bashrc를 로드하면 됩니다.

# Source bashrc
if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi


000001) 


1.  swap(2,048)  -> 10,000
2.  /boot(100)   ->  2,000(첫번째 파티션으로 만듦, 체크)
3.  /(3,072)     -> 12,000
4.  /usr(8,192)  -> 70,000
5.  /usr2(90,000)-> 90,000                               -> 120,000
6.  /var(4,096)  -> 12,000
7.  /tmp(4,096)  -> 12,000
8.  /data(70,000)-> 70,000
9.  /home(2,000) ->  2,000
10. /web(나머지 부분을 할당, 체크)

000001) Telnet
sudo apt-get install telnetd xinetd -y

service telnet
{
    disable         = no
    flags           = REUSE
    socket_type     = stream
    wait            = no
    user            = root
    server          = /usr/sbin/in.telnetd
    log_on_failure  += USERID
}

sudo /etc/init.d/xinetd restart

00004)
by root
mkdir /usr2/sinfo

00005)
groupadd other
useradd -d /usr2/sinfo -g other -s /bin/bash sinfo
passwd sinfo

00006)
cd /usr2
chown -R sinfo:other sinfo

00007)
apt update -y
apt-get install vsftpd

>>vsftpd.conf 파일 수정
vi /etc/vsftpd.conf
# Uncomment this to enable any form of FTP write command.
write enable=YES

>>vsftpd 서비스 재시작
/etc/init.d/vsftpd restart

00008)

apt-get update

apt-get install make
apt-get install gcc
apt-get install g++ 
apt-get install net-tools
apt-get install curl
apt install pkg-config

apt-get install cmake
apt-get install libssl-dev
apt-get install libexpat1-dev
apt-get install libboost-all-dev
apt-get install libncurses5-dev libncursesw5-dev

1. MySQL 다운로드 (경로: /usr/local)
$ cd /usr/local
$ wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.25.tar.gz
$ tar xvfz mysql-8.0.25.tar.gz

$ cd /usr/local/src/
$ wget https://boostorg.jfrog.io/artifactory/main/release/1.73.0/source/boost_1_73_0.tar.gz
$ tar xvfz boost_1_73_0.tar.gz

2.설치
$ cd /usr/local/mysql-8.0.25
$ rm -f CMakeCache.txt
$ mkdir tmp_mysql(USER ADD DIRECTORY)
$ cd tmp_mysql(USER ADD DIRECTORY)
$ cmake \
.. \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \
-DMYSQL_TCP_PORT=3306 \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DSYSCONFDIR=/etc \
-DWITH_EXTRA_CHARSETS=all \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DDOWNLOAD_BOOST=1 \
-DWITH_BOOST=/usr/local/src/boost_1_73_0
$ make
$ make install

3.MySQL DB 초기화
(1)그룹 지정

$ groupadd mysql
$ useradd -r -g mysql -s /bin/false mysql
그룹과 유저를 만들어야 한다.

-r : system account
-g : 그룹 지정
-s : user의 로그인 shell

(2) 디렉토리 생성

$ cd /usr/local/mysql
$ mkdir mysql-files
편한 이름의 디렉토리를 만들어 준다.

(3)권한주기

$ chown -R mysql:mysql /usr/local/mysql
$ chown mysql:mysql mysql-files
$ chmod 750 mysql-files
chown: 파일의 소유자를 변경

-R : 하위 디렉토리까지 소유권 할당

chmod : 사용권한을 변경

(4)기본 DB 생성

$ bin/mysqld --initialize --user=mysql \
--basedir=/usr/local/mysql \
--datadir=/usr/local/mysql/data

임시비밀번호가 나온다.
이 비밀번호는 나중에 써야하니 잘 기억해두자!
root@localhost : hYyR#f#D1ZCb

아래 명령어로 mysql로 전환한다.

$ bin/mysql -u root -p
명령어를 치면 비밀번호를 입력하게 되는데 아까 받은 초기 비밀번호를 입력하면 된다.

(2) 비밀번호 할당하기

mysql>alter user 'root'@'localhost' identified by '원하는 비밀번호';
mysql>flush privileges;
mysql>commit;

(3) 서버 종료


이때 비밀번호가 잘 변경됬는지 확인하면 된다.

5.MySQL 서비스 등록
서비스를 등록하면 서버가 실행되었을 때, mysql 이 자동으로 실행된다.

mysqld 파일을 복사한다.

$ sudo cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
mysqld 파일을 열어서 basedir 와 datadir 를 설정한다.

$ sudo vi /etc/init.d/mysqld


basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
mysqld 서비스를 등록한다.

$ update-rc.d mysqld defaults
reboot로 다시 시작한 뒤 보면 서버시작 안 해도 서버 시작이 되어있음을 확인할 수 있다.

$ reboot 
$ ps -ef | grep mysqld

/*----------------------------------------------------------*/



create database stockDB;
flush privileges;


백업)
/usr/local/mysql/bin/mysqldump -u root -p mysql > mysql_db.sql
(mysql>root계정까지 백업되므로, root패스워드가 원복시에 바뀌어버린다. 주의해야 한다.)
(mysql>root계정까지 백업되므로, root패스워드가 원복시에 바뀌어버린다. 주의해야 한다.)

원복)
/usr/local/mysql/bin/mysql -u root -p mysql < mysql_db.sql
(mysql>root계정까지 백업되므로, root패스워드가 원복시에 바뀌어버린다. 주의해야 한다.)
/usr/local/mysql/bin/mysql -u root -p stockDB < stockDB_db.sql

Install gcc downgrade)
add-apt-repository 'deb http://archive.ubuntu.com/ubuntu/ trusty main'
add-apt-repository 'deb http://archive.ubuntu.com/ubuntu/ trusty universe'
apt install gcc-4.7 g++-4.7 -y

update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7 10

비고)
update-alternatives --config gcc
update-alternatives --config g++

Compile)

root@stock:~# gcc --version
gcc (Ubuntu/Linaro 4.7.3-12ubuntu1) 4.7.3
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

root@stock:~#

PATH설정)

sinfo@stock:~/exe$ ./Batch
./Batch: error while loading shared libraries: libmysqlclient.so.21: cannot open shared object file: No such file or directory
sinfo@stock:~/exe$
sinfo@stock:~/exe$


root@stock:/usr/local# find ./ -name libmysqlclient.so.21
./mysql/lib/libmysqlclient.so.21
root@stock:/usr/local#

즉 /usr/local/mysql/lib 디렉토리를 /etc/profile에 추가시켜주면 됩니다. 혹은 개인계정 profile에 추가해도 무방

# vi /etc/profile
export LD_LIBRARY_PATH=/usr/local/mysql/lib/:LD_LIBRARY_PATH

100_partition_user_add_info.txt
0.00MB
110_install_make_succ.txt
0.00MB

1. 설치 및 기본 명령어
리눅스와 공유정신에 대하여 무엇인지 알아보고 수업간 사용할 가상머신 설치,
원활한 수업을 위한 설정,
실제 명령어를 사용하기 위한 튜토리얼 작업
리눅스 서버를 실습하기 위한 각종 시스템 구성
리눅스에서 사용되는 기본 명령어 학습

2. 기본 명령어
쉘운영의 기본이 되는 파일다루기
확인, 이동, 복사, 생성 등의 작업을 통해 리눅스에서 파일이 가지는 의미를 이해하고 실제 작업 및 확인을 통하여 기본적으로 사용하는 명령어들을 완전 숙지

3. 파이프 및 필터 유저 관리
로컬파일 보안출력결과를 내가 원하는대로 출력하고 원하는 파일로 구성한다.
시스템의 기반이 되는 유저제어를 통해 리눅스에서 유저가 가지는 실제 목적을 파악한다
파일에 권한을 부여하고 사용자들간의 파일 사용을 제한한다.

4. 프로세스 관리 & 디스크 관리
시스템 관리건강한 시스템을 유지하기 위해 프로세스 확인, 관리, 제어의 목적을 가지고 운영레벨에서 시스템을 구성해본다
저장소의 자유로운 사용이 시스템 운영의 필수 요소중 하나이다. 로컬 스토리지를 추가하여 시스템에서 실제 사용 할 수 있도록 학습한다.
systemd / init 프로세스 차이점 확인, 서비스 구동, 부팅 과정 이해

5. 리눅스 네트워크
백업 시스템리눅스를 서버로 사용하기 위한 기본 네트워크 설정
리눅스 기본 기능을 이용한 백업 기능 구현

#Ubuntu 18.04 apache-tomcat-**** & apache2 설치및 연동

1. 설정1
root@stock:/usr/local/tomcat8/conf# which java
/usr/local/jdk1.8.0_202/bin/java
root@stock:/usr/local/tomcat8/conf#

JAVA_HOME=/usr/local/jdk1.8.0_202로 설정한다.

2. 설정2
<Host name="localhost"  appBase="webapps"
      unpackWARs="true" autoDeploy="true">
<Context path="" docBase="/web/httpd/hexahtdocs" reloadable="true"/>
</Host>

3. 확인
http://19.168.0.37:8080
http://19.168.0.37:8080/common_sise/lower_rate.jsp?market=A


#install reference

 

apache_tomcat_9_install_guide.txt
0.01MB

+ Recent posts