Programming/version control

github + tomcat 배포.

사리생성 2023. 12. 30. 14:32

git 설치.

[root@localhost test]# git
bash: git: command not found...
Install package 'git-core' to provide command 'git'? [N/y] y


 * Waiting in queue...
The following packages have to be installed:
 git-core-2.39.3-1.el9_2.x86_64	Core package of git with minimal functionality
Proceed with changes? [N/y] y


 * Waiting in queue...
 * Waiting for authentication...
 * Waiting in queue...
 * Downloading packages...
 * Requesting data...
 * Testing changes...
 * Installing packages...
usage: git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]
           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           [--super-prefix=<path>] [--config-env=<name>=<envvar>]
           <command> [<args>]

다음은 여러가지 상황에서 자주 사용하는 깃 명령입니다:

작업 공간 시작 (참고: git help tutorial)
   clone     저장소를 복제해 새 디렉터리로 가져옵니다
   init      빈 깃 저장소를 만들거나 기존 저장소를 다시 초기화합니다

변경 사항에 대한 작업 (참고: git help everyday)
   add       파일 내용을 인덱스에 추가합니다
   mv        파일, 디렉터리, 심볼릭 링크를 옮기거나 이름을 바꿉니다
   restore   Restore working tree files
   rm        파일을 작업 폴더에서 제거하고 인덱스에서도 제거합니다

커밋 내역과 상태 보기 (참고: git help revisions)
   bisect    이진 탐색으로 버그를 만들어낸 커밋을 찾습니다
   diff      커밋과 커밋 사이, 커밋과 작업 내용 사이 등의 바뀐 점을 봅니다
   grep      패턴과 일치하는 줄을 표시합니다
   log       커밋 기록을 표시합니다
   show      여러가지 종류의 오브젝트를 표시합니다
   status    작업 폴더 상태를 표시합니다

커밋 내역을 키우고, 표시하고, 조작하기
   branch    브랜치를 만들거나, 삭제하거나, 목록을 출력합니다
   commit    바뀐 사항을 저장소에 기록합니다
   merge     여러 개의 개발 내역을 하나로 합칩니다
   rebase    커밋을 다른 베이스 끝의 최상위에서 적용합니다
   reset     현재 HEAD를 지정한 상태로 재설정화합니다
   switch    Switch branches
   tag       태그를 만들거나, 표시하거나, 삭제하거나, GPG 서명을 검증합니다

협동 작업 (참고: git help workflows)
   fetch     다른 저장소에서 오브젝트와 레퍼런스를 다운로드합니다
   pull      다른 저장소 또는 다른 로컬 브랜치에서 가져오거나 통합합니다
   push      원격 레퍼런스 및 그와 관련된 오브젝트를 업데이트합니다

'git help -a' and 'git help -g' list available subcommands and some
concept guides. See 'git help <command>' or 'git help <concept>'
to read about a specific subcommand or concept.
See 'git help git' for an overview of the system.

[root@localhost test]#

 

 

 

 

git 사용자 추가

[test@localhost test]$ git config --global user.email "test@test.test"
[test@localhost test]$ git config --global user.name "test"
[test@localhost test]$ git config -l
user.name=test
user.email=test@test.test
[test@localhost test]$

 

[test@localhost test]$ git clone https://github.com/test/tgroupware.git
'tgroupware'에 복제합니다...
Username for 'https://github.com': test
Password for 'https://test@github.com':
remote: Enumerating objects: 392, done.
remote: Counting objects: 100% (392/392), done.
remote: Compressing objects: 100% (288/288), done.
remote: Total 392 (delta 74), reused 381 (delta 73), pack-reused 0
오브젝트를 받는 중: 100% (392/392), 1.10 MiB | 37.63 MiB/s, 완료.
델타를 알아내는 중: 100% (74/74), 완료.
[test@localhost test]$ ls
tgroupware
[test@localhost test]$ cd tgroupware/
[test@localhost tgroupware]$ ls -al
합계 8
drwxr-xr-x. 3 tank tank  53 12월 30 14:49 .
drwxr-xr-x. 3 tank tank  24 12월 30 14:45 ..
drwxr-xr-x. 8 tank tank 163 12월 30 14:49 .git
-rw-r--r--. 1 tank tank 290 12월 30 14:49 .gitignore
-rw-r--r--. 1 tank tank 428 12월 30 14:49 README.md
[test@localhost tgroupware]$ git status
현재 브랜치 main
브랜치가 'origin/main'에 맞게 업데이트된 상태입니다.

커밋할 사항 없음, 작업 폴더 깨끗함
[test@localhost tgroupware]$ git checkout develop
branch 'develop' set up to track 'origin/develop'.
새로 만든 'develop' 브랜치로 전환합니다
[test@localhost tgroupware]$ ls

 

 

maven 빌드 (maven 설치시 java도 설치되므로 수동설치를 하기로 함)

[tank@localhost tgroupware]$ sudo yum install maven
[sudo] tank의 암호: 
마지막 메타자료 만료확인(2:00:56 이전): 2023년 12월 31일 (일) 오전 09시 21분 36초.
종속성이 해결되었습니다.
===============================================================================================================
 꾸러미                                        구조         버전                         저장소           크기
===============================================================================================================
설치 중:
 maven                                         noarch       1:3.6.3-15.el9               appstream        17 k
종속 꾸러미 설치 중:
 apache-commons-cli                            noarch       1.4-17.el9                   appstream        70 k
 apache-commons-codec                          noarch       1.15-7.el9                   appstream       301 k
 apache-commons-io                             noarch       1:2.8.0-8.el9                appstream       282 k
 apache-commons-lang3                          noarch       3.12.0-6.el9                 appstream       558 k
 atinject                                      noarch       1.0.3-6.el9                  appstream        22 k
 cdi-api                                       noarch       2.0.2-6.el9                  appstream        52 k
 google-guice                                  noarch       4.2.3-9.el9                  appstream       471 k
 guava                                         noarch       30.1-6.el9                   appstream       2.3 M
 httpcomponents-client                         noarch       4.5.13-3.el9                 appstream       656 k
 httpcomponents-core                           noarch       4.4.13-7.el9                 appstream       631 k
 jakarta-annotations                           noarch       1.3.5-13.el9                 appstream        44 k
 jansi                                         x86_64       2.3.3-6.el9                  appstream       109 k
 java-11-openjdk                               x86_64       1:11.0.21.0.9-2.el9          appstream       438 k
 java-11-openjdk-headless                      x86_64       1:11.0.21.0.9-2.el9          appstream        40 M
 jcl-over-slf4j                                noarch       1.7.30-13.el9                appstream        23 k
 jsoup                                         noarch       1.13.1-10.el9                appstream       375 k
 jsr-305                                       noarch       3.0.2-6.el9                  appstream        31 k
 maven-lib                                     noarch       1:3.6.3-15.el9               appstream       1.5 M
 maven-openjdk11                               noarch       1:3.6.3-15.el9               appstream       8.0 k
 maven-resolver                                noarch       1:1.6.1-10.el9               appstream       512 k
 maven-shared-utils                            noarch       3.3.4-3.el9                  appstream       150 k
 maven-wagon                                   noarch       3.4.2-7.el9                  appstream       111 k
 plexus-cipher                                 noarch       1.7-27.el9                   appstream        25 k
 plexus-classworlds                            noarch       2.6.0-11.el9                 appstream        59 k
 plexus-containers-component-annotations       noarch       2.1.0-10.el9                 appstream        17 k
 plexus-interpolation                          noarch       1.26-11.el9                  appstream        79 k
 plexus-sec-dispatcher                         noarch       1.4-37.el9                   appstream        33 k
 plexus-utils                                  noarch       3.3.0-10.el9                 appstream       253 k
 publicsuffix-list                             noarch       20210518-3.el9               appstream        82 k
 sisu                                          noarch       1:0.3.4-10.el9               appstream       509 k
 slf4j                                         noarch       1.7.30-13.el9                appstream        68 k
취약한 종속 꾸러미 설치 중:
 java-11-openjdk-devel                         x86_64       1:11.0.21.0.9-2.el9          appstream       3.3 M


연결 요약
===============================================================================================================
설치  33 꾸러미

전체 내려받기 크기: 53 M
설치된 크기 : 196 M
진행할까요? [y/N]: n
작업이 중지됩니다.

 

 

 

maven 수동 설치

https://maven.apache.org/download.cgi

 

Maven – Download Apache Maven

Downloading Apache Maven 3.9.6 Apache Maven 3.9.6 is the latest release: it is the recommended version for all users. System Requirements Java Development Kit (JDK) Maven 3.9+ requires JDK 8 or above to execute. It still allows you to build against 1.3 and

maven.apache.org

 

https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.tar.gz

 

[root@localhost test]# wget https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.tar.gz
--2023-12-31 11:30:34--  https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.tar.gz
Resolving dlcdn.apache.org (dlcdn.apache.org)... 151.101.2.132, 2a04:4e42::644
Connecting to dlcdn.apache.org (dlcdn.apache.org)|151.101.2.132|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 9410508 (9.0M) [application/x-gzip]
Saving to: `apache-maven-3.9.6-bin.tar.gz.1'

apache-maven-3.9.6-bin.tar. 100%[==========================================>]   8.97M  --.-KB/s    in 0.1s    

2023-12-31 11:30:34 (68.8 MB/s) - `apache-maven-3.9.6-bin.tar.gz.1' saved [9410508/9410508]

[root@localhost test]# ls
apache-maven-3.9.6  apache-maven-3.9.6-bin.tar.gz  apache-maven-3.9.6-bin.tar.gz.1  tgroupware

[root@localhost test]# tar xvzf apache-maven-3.9.6-bin.tar.gz 
apache-maven-3.9.6/README.txt
apache-maven-3.9.6/LICENSE
apache-maven-3.9.6/NOTICE
... ...

[root@localhost test]# mv apache-maven-3.9.6 /usr/local/maven
[root@localhost test]# sudo vi /etc/profile.d/maven.sh
export M2_HOME=/usr/local/maven
export MAVEN_HOME=$M2_HOME/bin
export PATH=$MAVEN_HOME:$PATH
[root@localhost test]# source /etc/profile.d/maven.sh
[root@localhost test]# mvn -v
Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)
Maven home: /usr/local/maven
Java version: 1.8.0_392, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.392.b08-3.el9.x86_64/jre
Default locale: ko_KR, platform encoding: UTF-8
OS name: "linux", version: "5.14.0-362.8.1.el9_3.x86_64", arch: "amd64", family: "unix"
[root@localhost test]#

 

[root@localhost tgroupware]# mvn -f pom.xml clean install
[INFO] Scanning for projects...
[INFO] 
[INFO] --------------------------< com.gu:project9 >---------------------------
[INFO] Building project9 1.0
[INFO]   from pom.xml
[INFO] --------------------------------[ war ]---------------------------------
[INFO] 
[INFO] --- clean:3.2.0:clean (default-clean) @ project9 ---
[INFO] Deleting /home/tank/test/tgroupware/target
[INFO] 
[INFO] --- resources:3.3.1:resources (default-resources) @ project9 ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 19 resources from src/main/resources to target/classes
[INFO] 
[INFO] --- compiler:2.3.2:compile (default-compile) @ project9 --
[INFO] Compiling 74 source files to /home/tank/test/tgroupware/target/classes
[INFO] 
[INFO] --- resources:3.3.1:testResources (default-testResources) @ project9 ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/tank/test/tgroupware/src/test/resources
[INFO] 
[INFO] --- compiler:2.3.2:testCompile (default-testCompile) @ project9 ---
[INFO] No sources to compile
[INFO] 
[INFO] --- surefire:3.2.2:test (default-test) @ project9 ---
[INFO] No tests to run.
[INFO] 
[INFO] --- war:3.4.0:war (default-war) @ project9 ---
[INFO] Packaging webapp
[INFO] Assembling webapp [project9] in [/home/tank/test/tgroupware/target/project9-1.0]
[INFO] Processing war project
[INFO] Copying webapp resources [/home/tank/test/tgroupware/src/main/webapp]
[INFO] Building war: /home/tank/test/tgroupware/target/project9-1.0.war
[INFO] 
[INFO] --- install:3.1.1:install (default-install) @ project9 ---
[INFO] Installing /home/tank/test/tgroupware/pom.xml to /root/.m2/repository/com/gu/project9/1.0/project9-1.0.pom
[INFO] Installing /home/tank/test/tgroupware/target/project9-1.0.war to /root/.m2/repository/com/gu/project9/1.0/project9-1.0.war
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.823 s
[INFO] Finished at: 2023-12-31T14:19:53+09:00
[INFO] ------------------------------------------------------------------------
[root@localhost tgroupware]#

 

스크립트 생성

[root@localhost tgroupware]# cat build.sh 
#!/bin/bash
/usr/local/maven/bin/mvn -f ./pom.xml clean install
mv /home/test/tgroupware/target/project9*.war /home/tomcat/webapps/.
chown tomcat.tomcat -R /home/tomcat/webapps/

 

 

 

 

 

 

 

 

'Programming > version control' 카테고리의 다른 글

.gitkeep  (0) 2024.02.06
리눅스 절전모드 해제  (0) 2023.12.31
rocky9 tomcat 설치  (0) 2023.12.26
rocky9에 mariadb 11.2 설치 및 실행  (1) 2023.12.26
LG 공유기 NAT or Port powading  (0) 2023.12.25