728x90
반응형

Django Unit Test

  • github 에서 Django 를 git clone 하면 ~/django/tests 디렉토리에 테스트 스위트가 있다.
  • 테스트 환경은 Tibero7 과 Django 5.1 버전을 연동하여 테스트해본다.
  • Django 5.1  사용하기 위해서는 Python 3.10 버전 이상을 설치해야 한다. 
  • https://docs.djangoproject.com/ko/5.1/faq/install/
 

자주묻는 질문: 설치 | Django documentation

The web framework for perfectionists with deadlines.

docs.djangoproject.com

 

 

Django UnitTest 환경 셋팅

$ git clone https://github.com/YourGitHubName/django.git django-repo
$ cd django-repo/tests
$ python -m pip install -e ..
$ python -m pip install -r requirements/py3.txt
$ ./runtests.py

 

Django UnitTest 수행

  • runtests.py  실행하여 단위 테스트를 실행할 수 있다.
  •  --settings=[테스트 환경 설정 정보] 접속 및 테스트 수행 관련 정보를 작성 한 설정 파일이다.
python runtests.py --settings=test_tibero

#특정 테스트 스위트만 수행 하고 자 할때
python runtests.py --settings=test_tibero  generic_relations

#수행된 SQL 정보를 확인하고 싶다면  --debug-sql 옵션을 추가 합니다.
./runtests.py --settings=test_tibero  queries  --debug-sql

#--verbosity=3 옵션을 적용 하면 현재 테스트 진행중인 SQL 실행 내역을 실시간으로 확인 가능 합니다. 
./runtests.py --settings=test_tibero  queries  --debug-sql --verbosity=3

(v_djangoenv) [django@my-rocky9.4:/home/django/django/tests]$ python runtests.py --settings=test_tibero  generic_relations
Testing against Django installed in '/home/django/v_djangoenv/lib/python3.10/site-packages/django' with up to 4 processes
Found 82 test(s).
Creating test database for alias 'default'...
Creating test user...
System check identified no issues (0 silenced).

Running tests...
----------------------------------------------------------------------
  test_absolute_max (generic_relations.test_forms.GenericInlineFormsetTests) ... ok (0.098s)
  test_absolute_max_with_max_num (generic_relations.test_forms.GenericInlineFormsetTests) ... ok (0.006s)
  test_can_delete_extra (generic_relations.test_forms.GenericInlineFormsetTests) ... ok (0.001s)
  test_disable_delete_extra (generic_relations.test_forms.GenericInlineFormsetTests) ... ok (0.001s)

----------------------------------------------------------------------
Ran 82 tests in 1.110s

OK

Generating XML reports...
Generated XML report: /home/django/django/tests/output/xunit/TEST-generic_relations.test_forms.GenericInlineFormsetTests-20250312185624.xml
Generated XML report: /home/django/django/tests/output/xunit/TEST-generic_relations.tests.GenericRelationsTests-20250312185624.xml
Generated XML report: /home/django/django/tests/output/xunit/TEST-generic_relations.tests.ProxyRelatedModelTest-20250312185624.xml
Generated XML report: /home/django/django/tests/output/xunit/TEST-generic_relations.tests.TestInitWithNoneArgument-20250312185624.xml
Destroying test database for alias 'default'...
Destroying test user...
Destroying test database tables...

  • ./runtests.py --help 를 통해 보다 다양한 옵션에 대한 사용법에 대해 알아 볼수 있다.

 

Django UnitTest 결과 확인

  • 테스트 수행 결과를 확인하기 위해서는 xmlrunner 패키지를 추가해서 테스트를 진행하면 된다.
  • 테스트 수행이 완료되면 TEST_OUTPUT_DIR 로 설정한 디렉토리에 xml 파일로 Reporting 결과가 남고
  • junit2html 팩키지를 통해 xml 파일을 html 파일로 변경 하면 가독성면에서 테스터가 결과를 한눈에 확인 가능 하다.
  • 또한 allure 팩키지를 사용 하면 html 파일 보다 더욱 가독성있게 테스트결과를 한눈에 확인 가능 하다 (추천)
pip install unittest-xml-reporting
pip install allure-pytest
pip install junit2html   
  • test_tibero.py 설정 추가
TEST_OUTPUT_DIR = "/home/django/django/tests/output/xunit"
TEST_RUNNER = 'xmlrunner.extra.djangotestrunner.XMLTestRunner'
TEST_OUTPUT_VERBOSE = 2  # 상세 출력
TEST_OUTPUT_DESCRIPTIONS = True

HTML 파일로 변경 해서 결과 확인 하는 방법

  • junit2html 를 통해 xml 결과 html 로 변경 하는 방법
    • TEST-generic_relations.tests.GenericRelationsTests-20250312034521.xml -> report.html 파일로 변경
junit2html /home/django/django/tests/output/xunit/TEST-generic_relations.tests.GenericRelationsTests-20250312034521.xml 
/home/django/django/tests/output/xunit/report.html

allure 를 사용 해서 브라우저를 통해 결과 확인 하는 방법

  • allure 최신 버전 다운로드 후 설치를 진행 한다.
wget https://github.com/allure-framework/allure2/releases/download/2.21.0/allure-2.21.0.tgz

tar -xvzf allure-2.21.0.tgz
sudo mv allure-2.21.0 /opt/allure

sudo ln -s /opt/allure/bin/allure /usr/local/bin/allure
allure --version
  • 테스트 실행 후 Allure 결과 생성
allure generate /home/django/django/tests/output/xunit -o /home/django/django/tests/output/allure_report --clean
  • 정상적으로 리포팅 결과 가 변환 되면 allure_report 디렉토리에 여러 파일들이 생성 된다 .
(v_djangoenv) [django@my-rocky9.4:/home/django/django/tests/output/xunit]$ ll
합계 28
-rw-r--r--. 1 django django  3640  3월 13 08:59 TEST-generic_relations.test_forms.GenericInlineFormsetTests-20250312185949.xml
-rw-r--r--. 1 django django 14721  3월 13 08:59 TEST-generic_relations.tests.GenericRelationsTests-20250312185949.xml
-rw-r--r--. 1 django django  1933  3월 13 08:59 TEST-generic_relations.tests.ProxyRelatedModelTest-20250312185949.xml
-rw-r--r--. 1 django django   449  3월 13 08:59 TEST-generic_relations.tests.TestInitWithNoneArgument-20250312185949.xml
  • /home/django/django/tests/output/allure_report 
(v_djangoenv) [django@my-rocky9.4:/home/django/django/tests/output/allure_report]$ ll
합계 2296
-rw-r--r--.  1 django django  776554  3월 13 08:59 app.js
drwxr-xr-x.  4 django django    4096  3월 13 09:00 data
drwxr-xr-x.  2 django django      73  3월 13 08:59 export
-rw-r--r--.  1 django django   15086  3월 13 08:59 favicon.ico
drwxr-xr-x.  2 django django     132  3월 13 08:59 history
-rw-r--r--.  1 django django     665  3월 13 08:59 index.html
drwxr-xr-x. 11 django django     137  3월 13 08:59 plugins
-rw-r--r--.  1 django django 1542785  3월 13 08:59 styles.css
drwxr-xr-x.  2 django django    4096  3월 13 09:00 widgets
  • index.html 파일을 실행 하면 결과 확인이 가능 하다.
  • http://127.0.0.1:3001/django/tests/output/allure_report/index.html 

728x90
반응형
728x90
반응형

7z 파일 압축 해제 방법 

  • 압축 해제 방벙 
#7z 파일 압축 해제
7z x 파일명.7z

#특정 폴더에 압축 해제
7z x 파일명.7z -o/경로/디렉토리

#압축 해제 시 기존 파일 덮어쓰기 없이 진행
7z x 파일명.7z -o/경로/디렉토리 -aos

#암호가 걸린 7z 파일 압축 해제방법
7z x 파일명.7z -p비밀번호

# 압축된 파일 내부 목록 확인
7z l 파일명.7z
  • 에러발생시 팩키지 설치 필요 
Last metadata expiration check: 3:26:19 ago on Mon Feb 24 17:53:46 2025.
No match for argument: p7zip
No match for argument: p7zip-plugins Error: Unable to find a match: p7zip p7zip-plugins
#EPEL 저장소를 활성화
sudo dnf install -y epel-release

#설치
sudo dnf install -y p7zip p7zip-plugins

 

7z 파일 압축  방법 

  • 압축 방법 
#기본 7z 압축 방법
#7z a 압축파일명.7z 파일명

7z a archive.7z myfile.txt

#여러 개의 파일을 압축
#7z a archive.7z 파일1 파일2 디렉토리
7z a mydata.7z file1.txt file2.txt folder1/

#특정 확장자의 파일만 압축
7z a archive.7z *.txt

#암호 설정  압축
#7z a -p비밀번호 archive.7z 파일명
7z a -p1234 secret.7z confidential.txt

 

 

 

728x90
반응형
728x90
반응형

Podman Registry 설정 방법

기본 레지스트리 지정 방법

  • 설정 파일 : /etc/containers/registries.conf
  • 등록 방법 :unqualified-search-registries
unqualified-search-registries = ["docker.io", "quay.io", "registry.fedoraproject.org"]

 

  • 사용자 지정 프라이빗 레지스트리 등록 방법 : [[registry]]
[[registry]]
location = "myregistry.example.com"
insecure = false

 

  • location : 사용할 레지스트리 주소
  • insecure = false : HTTPS(보안 연결) 사용 (기본값)
  • insecure = true : HTTP(보안 미사용) 허용 (사내 레지스트리에서 필요할 수 있음)

podman 설정 적용 

  • 버전 정보 확인 
podman version

podman compose version
$ podman version
Client:       Podman Engine
Version:      5.2.2
API Version:  5.2.2
Go Version:   go1.22.7 (Red Hat 1.22.7-2.el9_5)
Built:        Tue Nov 12 21:34:59 2024
OS/Arch:      linux/amd64

$ podman compose version
>>>> Executing external compose provider "/hdd/syma8/.local/bin/podman-compose". Please see podman-compose(1) for how to disable this message. <<<<

podman-compose version 1.3.0
podman version 5.2.2
  • podman 재시작 
 systemctl  restart podman

 

podman  기본 사용 명령어 

  • podman image 삭제 방법 
#실행 중인 것 포함하여 모든 컨테이너 정리 
podman stop -a
#컨테이너 삭제 
podman rm -a
#podman 사용 이미지 삭제 
podman rmi -a

#모든 pod 삭제 
podman pod rm -a

#캐시 및 네트워크 데이터도 정리 
podman system prune -a

 

 

podman error  조치 가이드

  • 현상:
    • level=error msg="failed to move the rootless netns pasta process to the systemd user.slice: dial unix /run/user/0/bus: connect: permission denied"
    • rootless 환경에서 Podman을 실행 중인데, DBus 및 systemd 관련 문제가 있어 발생 하는 문제 
[pod_svc]          | time="2025-02-21T15:41:15+09:00" level=error msg="failed to move the rootless netns pasta process to the systemd user.slice: dial unix /run/user/0/bus: connect: permission denied"
[pod_svc]          | [WARN  netavark::dns::aardvark] Failed to delete aardvark-dns entries after failed start: failed to get aardvark pid: IO error: No such file or directory (os error 2)
[pod_svc]          | time="2025-02-21T15:41:15+09:00" level=error msg="Removing timer for container e2d4353bc33469927b0a0a41092a5f89f8c11f2dd1e58c7ea43c14ce3c47277f healthcheck: unable to get systemd connection to remove healthchecks: lstat /tmp/storage-run-1014/systemd: no such file or directory"
[pod_svc]          | Error: unable to start container e2d4353bc33469927b0a0a41092a5f89f8c11f2dd1e58c7ea43c14ce3c47277f: netavark: IO error: Error while applying dns entries: IO error: aardvark-dns failed to start: Failed to connect to bus: No such file or directory

 

  • 조치 
    • Linger=yes 설정 확인 
whoami
id
loginctl show-user $(whoami)
loginctl enable-linger $(whoami)
  • DBus 및 systemd user session 문제 해결
    • 모든 네트워크 및 DNS 설정 삭제 & Podman 시스템 전체 초기화 
rm -rf ~/.config/containers/aardvark-dns
rm -rf ~/.local/share/containers/networks

podman system reset

 

728x90
반응형
728x90
반응형

MkDocs 설치 방법 

  • MkDocs를 활용해 Markdown(.md) 형식으로 작성된 가이드 문서를 효율적으로 관리 하는 방법에 대해 알아본다.

python 가상환경 생성 

  • MkDocs 는 python 을 통개 개발된 문서 관리 유틸이다. 
  • python  에서 제공 하는 가상환경(venv)을 만들어서MkDocs 를 설치 한다. 
#mkdocs 가상환경 생성 
python3 -m venv venv_mkdocs

#가상환경 활성화 
source venv_mkdocs/bin/activate
[guide_doc@my-rocky9.4:/home/guide_doc]$ python3 -m venv venv_mkdocs  
[guide_doc@my-rocky9.4:/home/guide_doc]$ ll
합계 0
drwxr-xr-x. 5 guide_doc guide_doc 74  1월 13 14:39 venv_mkdocs
[guide_doc@my-rocky9.4:/home/guide_doc]$ source venv_mkdocs/bin/activate 
(venv_mkdocs) [guide_doc@my-rocky9.4:/home/guide_doc]$ 

MkDocs 설치 

  • pip 를 이용한 mkdocs 를 설치 한다. 
  • 설치후 mkdocs --version 를 이요해 버전을 확인 합니다. 
  • 삭제는 pip uninstall mkdocs 명령을 통해 삭제 할수 있습니다. 
pip3 install mkdocs
pip install --upgrade pip

# mkdocs 버전확인
mkdocs --version
mkdocs, version 1.6.1 from /home/guide_doc/venv_mkdocs/lib/python3.8/site-packages/mkdocs (Python 3.8)

 

MkDocs 프로젝트 생성 

  • mkdocs new 명령을 통해 문서를 관리할 프로젝트를 생성한다. 
mkdocs new md_guide

 

(venv_mkdocs) [guide_doc@my-rocky9.4:/home/guide_doc]$ mkdocs new md_guide
INFO    -  Creating project directory: md_guide
INFO    -  Writing config file: md_guide/mkdocs.yml
INFO    -  Writing initial docs: md_guide/docs/index.md
(venv_mkdocs) [guide_doc@my-rocky9.4:/home/guide_doc]$ ll
합계 0
drwxr-xr-x. 3 guide_doc guide_doc 36  1월 13 14:51 md_guide
drwxr-xr-x. 5 guide_doc guide_doc 74  1월 13 14:39 venv_mkdocs
(venv_mkdocs) [guide_doc@my-rocky9.4:/home/guide_doc]$ tree -a md_guide/
md_guide/
├── docs
│   └── index.md
└── mkdocs.yml

 

 

MkDocs 서버 실행 

  • mkdocs serve 명령을 실행하면 브라우저에서 실시간으로 작성된 문서를 확인 할수 있다. 
  • 기본 수행시 로컬에서만 접속이 가능 하다. 
    • http://127.0.0.1:8000
## 로컬에서만 접속 가능 
mkdocs serve 

##외부 접속을 허용하려면 -a 0.0.0.0:8000 옵션을 사용 한다.
mkdocs serve -a 0.0.0.0:8000

#백그라운드 실행
nohup mkdocs serve -a 0.0.0.0:8000 > mkdocs.log 2>&1 &
  • 브라우저에 접속을 하면 아래 URL 을 통해 문서를 확인할수 있다. 

 

 

MkDocs  테마 적용 

pip install mkdocs-dracula-theme
  • vi mkdocs.yml 
site_name: My Docs
theme:
      name: dracula
theme:
    name: dracula

 

pip install mkdocs-material

MkDocs  플러그인 설치 

mkdocs-awesome-pages-plugin

  • 사이드바와 네비게이션을 자동 정렬 하는 플러그인
pip install mkdocs-awesome-pages-plugin
  • vi mkdocs.yml 
plugins:
    - search
    - awesome-pages

 

markdown_extensions

  • markdown 기능을 확장해서 사용 할수 있는 기능 
pip install markdown_extensions
pip install pymdown-extensions

 

  • vi mkdocs.yml
markdown_extensions:

  # Python Markdown
  - abbr
  - admonition
  - attr_list
  - def_list
  - footnotes
  - md_in_html
  - toc:
      permalink: true

  # Python Markdown Extensions
  - pymdownx.arithmatex:
      generic: true
  - pymdownx.betterem:
      smart_enable: all
  - pymdownx.caret
  - pymdownx.details
  - pymdownx.highlight
  - pymdownx.inlinehilite
  - pymdownx.keys
  - pymdownx.mark
  - pymdownx.smartsymbols
  - pymdownx.superfences
  - pymdownx.tabbed:
      alternate_style: true
  - pymdownx.tasklist:
      custom_checkbox: true
  - pymdownx.tilde

확장 이름기능 설명설치 필요 여부

toc 문서 내 목차 생성 기본 제공
admonition 강조 블록 (노트, 경고, 팁 등) 생성 기본 제공
tables Markdown 표 지원 기본 제공
pymdownx.superfences 코드 블록 기능 확장 설치 필요
pymdownx.highlight 코드 강조 기능 향상 설치 필요
pymdownx.tabbed 탭으로 콘텐츠 구분 설치 필요
pymdownx.tasklist 체크박스 스타일 지원 설치 필요
pymdownx.details 접을 수 있는 세부정보 블록 생성 설치 필요
pymdownx.progressbar 진행 바 생성 설치 필요
abbr 약어 지원 기본 제공
meta 문서의 메타데이터를 추가 기본 제공

mkdocs-mermaid2-plugin

  • Mermaid 를 이용한 다이어그램을 표시해주는 기능 
pip install mkdocs-mermaid2-plugin
  • vi mkdocs.yml
markdown_extensions:
  - pymdownx.superfences:
        # make exceptions to highlighting of code:
      custom_fences:
        - name: mermaid
          class: mermaid
          format: !!python/name:mermaid2.fence_mermaid_custom  
plugins:
  - mermaid2:
      version: 10.0.2
      theme: "dark"       # Mermaid 다이어그램 테마 (default, dark 등)
      # securityLevel: "loose" # 보안 수준 (loose로 설정하면 외부 자원 로드 가능)

MkDocs PDF

  • pdf 파일을  브라우져에서 출력해주는 기능입니다. 
pip install mkdocs-pdf
  • vi mkdocs.yml
# mkdocs.yml
markdown_extensions:
  - attr_list
plugins:
  - mkdocs-pdf
  • 사용법
![Alt text](<path to pdf>){ type=application/pdf style="min-height:25vh;width:100%" }

MkDocs navigator 설정 

  • material 테마 기준으로 nav 항목에서 좌측 side bar 와 top bar 매뉴 설정이 가능 하다.
  • vi mkdocs.yml
nav:
  - Home: index.md
  - About: about.md
  - Guides:
      - Getting Started: guides/getting-started.md
      - Advanced Topics: guides/advanced.md
 
  •  index.md
# Welcome to MkDocs

For full documentation visit [mkdocs.org](https://www.mkdocs.org).

## Commands

* `mkdocs new [dir-name]` - Create a new project.
* `mkdocs serve` - Start the live-reloading docs server.
* `mkdocs build` - Build the documentation site.
* `mkdocs -h` - Print help message and exit.

## Project layout

    mkdocs.yml    # The configuration file.
    docs/
        index.md  # The documentation homepage.
        ...       # Other markdown pages, images and other files.​
 

 

  • mkdocs 디렉토리 구조
$ tree -L 4
.
├── docs
│   ├── about.md
│   ├── doctech
│   │   ├── README.md
│   │   └── guides
│   │       ├── advanced.md
│   │       └── getting-started.md
│   └── index.md
├── mkdocs.yml
└── overrides

 

 

728x90
반응형

'IT지식' 카테고리의 다른 글

쉘스크립트  (0) 2024.11.08
[IT지식] REST FUL 이란?  (0) 2022.06.04
[IT 지식]스케일 아웃 vs 스케일 업  (0) 2022.04.18
728x90
반응형

Gitlab 프로젝트 VS Code 연결 

  • Gitlab 과  VS Code를 연동   하는 방법에 대해 설명 한다. 

GitLens, Git History  설치

  • VS code 실행 후 마켓 플레이스 에서GitLens, Git History  를 설치한다. 

 

VSCode Git Clone 방법 

  • F1 버튼을 눌러 git clone 선택합니다.
  • Git url 주소를 입력한다. 
    • VS Code 레파지토리 URL 정보 입력 <- gitlab http url 입력 

  • 복제할 로컬 디렉토리를 선택합니다. 
  • 없을경우 신규 생성 합니다. 
  • 작업영역을 추가하면 해당 폴더에 Gitlab 리소스가 로컬 Repository 에 다운로드 됩니다. 

 

VSCode 파일 변경 사항 커밋 

  • 테스트를 위해 test.md 파일을 생성 합니다. 
  • 파일에 간단한 내용을 작성합니다. 

 

  • Source Control  항목에 들어가서 변경 사항에 대한 커밋 메시지를 작성한후 커밋 버튼을 클릭합니다. 

 

  • 이후 변경 내용 동기화 버튼을 클릭 합니다. 
  • 동기화 하지 않으면 Git 서버에 변경내용이 저장 되지 않습니다. 

  • 정상 업로드가 되면 Gitlab 에 추가된 test.md 파일이 업로드 된것을 확인 할수 있습니다. 

 

VS Code MarkDown 확장 패키지 설치 

  • Gitlab 에서 Mark down 문법으로 작성된 문서를 수정하고 또 편하게 보기 위해서는 몇가지 확장 패키를 설치 하면 유용합니다. 
    • Diagram and chart  를 보기위해 아래 패키지를 설치 합니다. 
    • Markdown Preview Mermaid Support

 

  • 확장자를 추가하면 Gitlab 에서 지원하는 다양한 플로우 차트와 다이그램을 VS Code 에서 작성 하고 미리보기 를 통해 확인해볼수 있다. 

 

 

728x90
반응형
728x90
반응형

"postmaster.pid" 잠금 파일이 이미 있음 에러 

  • 원인
    • postmaster.pid 파일은 PostgreSQL 서버가 실행 중일 때 생성되며, 서버가 종료되면 자동으로 삭제 되지만 
    • PostgreSQL  가 비정상 종료 할경우에  파일이 남아있어 에러가 발생 할수 있다. 
  • 조치방법 1
    • postmaster.pid 파일 삭제 
    • PostgreSQL 서비스 재시작 
cd /var/lib/pgsql/<version>/data
ls postmaster.pid
rm postmaster.pid
systemctl start postgresql

 

  • 조치방법 2
    • 권한 확인 및 소유자 변경
    • 이후에도 정상 기동이 되지 않으면 OS reboot 이후  PostgreSQL 서비스 재시작 
ls -ld /var/lib/pgsql/<version>/data
chown -R postgres:postgres /var/lib/pgsql/<version>/data

#os reboot
shutdown -r now 
systemctl start postgresql

 

728x90
반응형
728x90
반응형

Remote SSH 원 격 접속 (비번 입력 없이)  방법

  • VSCode 에서 Remote 접속 시에 비밀 번호 없이 입력 없이 접속 하는 방법에 대해 설명합니다. 
  • 아래처럼 Remote 서버 접속시 매번 비밀번호를 입력하게 된다. 
  • 이런 불편한점을 없애고 ssh 인증키를 발급받아 접속하고자하는 Remote 원격 서버에 키를 등록한후 
  • 매번 비밀 번호를 입력한후 접속 하는 수고를 덜수 있다. 

윈도우 ssh-key 발급 

  • Windows PowerShell 을 실행 시킨후 ssh key 를 발급 받습니다. 

 

#ssh 인증키 발급
ssh-keygen -t rsa -b 4096

#인증키 확인 
Get-Content .\.ssh\id_rsa.pub

 

 

authorized_keys  파일 생성(Remote 서버) 

.ssh 디렉토리 이동후 authorized_keys  파일 생성후 윈도우 에서 발급 받은 key 값을 복사 한다. 

[rocky@my-rocky9 .ssh]$ ll
합계 12
-rw-r--r--. 1 rocky rocky  578 11월 18 15:40 authorized_keys
-rw-------. 1 rocky rocky 3381 11월 18 15:39 id_rsa
-rw-r--r--. 1 rocky rocky  743 11월 18 15:39 id_rsa.pub

 

VSCode ssh Config 파일 수정

  • vscode ssh 접속 설정 파일에  발급받은 키값을 추가 한다. (IdentityFile D:\200.MyConfig\VSCode\.ssh\id_rsa )
Host rocky-192.168.116.xxx
    HostName 192.168.116.xxx
    User rocky
    Port 22
    IdentityFile D:\200.MyConfig\VSCode\.ssh\id_rsa

 

추가후 재섭속시 비밀번호 없이 Remote SSH 접속시 비밀번호 업이 접속 할수 있다. 

 

 

728x90
반응형
728x90
반응형

SVN 설치 

dnf instatall subversion
svn  --version

 

SVN 기본 명령어 

  • 리소드 체크 아웃 
svn checkout https://example.com/svn/my_project/trunk
  • 리소스 업데이트 (체크아웃 받은 리소스에 대해 변경된 사항을 로컬로 업데이트 합니다.) 
svn update
  • 파일 상태 확인 
    • M: 수정 파일
    • A: 추가 파일
    • D: 삭제 파일
    • ?: 버전 관리되지 않은 파일
svn status
  • 파일 정보 저장 및 변경 
#파일 추가 
svn add new_file.txt 

#파일 저장 
svn commit -m "추가한 내용 기록"

#파일 삭제 
svn delete old_file.txt

#파일 내용 비교 
svn diff current_file.txt

#파일 변경 내용 확인
svn log current_file.txt

SVN 트러블 슈팅 

svn: warning: cannot set LC_CTYPE locale 에러 

  • 해당 에러는 SVN 클라이언트가 로케일 설정이 맞지 않을때 발생하는 에러 입니다. 
  • 위 현상을 해결 하기 위해서는 아래 단계로 현재 로케일 설정을 확인하고 환경에 맞는 로케일 로 설정을 맞춰 줍니다. 
  •  
$ svn checkout svn://1~~~
svn: warning: cannot set LC_CTYPE locale
svn: warning: environment variable LANG is UTF-8
svn: warning: please check that your locale name is correct

 

728x90
반응형

'04.DevTools' 카테고리의 다른 글

[IntelliJ] Intellij Gitlab 연동  (0) 2024.08.16
[Nexus]Centos7 nexus 설치 및 이클립스 연동  (0) 2022.04.21
728x90
반응형
  • 리눅스환경 에서 날짜를 변경하는 방법에 대해 설명 합니다. 
  • Rocky Linux 환경에서는 Centos 에서 지원하는 rdate 를 더이상 지원하지 않는다 
  • Rokcy Lunux 에서 시간을 변경하는 방법으로 timedatectl  명령을 사용하여 시간을 변경할수 있다 
  • timedatectl 명령을 통해 현재 서버의 날짜와 시간을 변경하는 방법에 대해 알아보겠습니다. 

timedatectl  설명

  • 현재시간을 확인하고 임으로 날짜 및 변경하는 방법은 아래 작성한 내용과 같다. 
  • 단  임으로 시간 병경후 NTP  동기화 설정시 바로 현재 시간으로 동기화 되지 않는 이유는 
  • NTP 가 시간이 일정 간격으로 서서히 조정되도록 설계 되어 있어 바로 현재 시간이 적용 되지 않는다고 한다. 
  • 바로 현재 시간으로 동기화를 하기 위해서는 chrony 나 ntpd(Rocky Linux 에서는 지원하지 않음) 를 이용해서 현재 시간으로 업데이트 할수 있다 . 

timedatectl  기능 

#현재 시간 확인 하기
timedatectl


#시간대 설정방법 (ex: 서울):
timedatectl set-timezone Asia/Seoul


#직접 날짜와 시간 설정  하기
#timedatectl set-time 'YYYY-MM-DD HH:MM:SS'
timedatectl set-time '2024-11-10 15:30:00'

#NTP(Network Time Protocol) 동기화 활성화
timedatectl set-ntp true
#timedatectl set-ntp false

 

chrony 사용법 

  • 설치 및 서비스 시작 방법
#설치
dnf install chrony

#서비스 시작
systemctl enable --now chronyd

#서버시간 즉시 시간 동기화 
chronyc -a makestep

 

 

시간 변경 방법

  • ntp 동기화 설정이 되어있다면 임으로 시간 변경을 할수 없다 .
    • Failed to set time: Automatic time synchronization is enabled 발생
  • timedatectl set-ntp false 를 통해  ntp 동기화 설정을 꺼두고 시간 변경이 완료 된후 현재 시간으로 
  • 시간으로 동기화 하고 싶다면 timedatectl set-ntp true 이후 chronyc 서비스를 활성화 시키면 된다. 
[root@rocky9.4:/root]$ date
Tue Nov 12 13:43:48 KST 2024
[root@rocky9.4:/root]$ timedatectl set-time '2023-11-10 15:30:00'
Failed to set time: Automatic time synchronization is enabled
[root@rocky9.4:/root]$  timedatectl set-ntp false
[root@rocky9.4:/root]$ timedatectl set-time '2023-11-10 15:30:00'
[root@rocky9.4:/root]$ date
Fri Nov 10 15:30:01 KST 2023
[root@rocky9.4:/root]$ timedatectl set-ntp true
[root@rocky9.4:/root]$ date
Fri Nov 10 15:30:06 KST 2023
[root@rocky9.4:/root]$ chronyc -a makestep
200 OK
[root@rocky9.4:/root]$ date
Fri Nov 10 15:30:10 KST 2023
[root@rocky9.4:/root]$ systemctl enable --now chronyd
[root@rocky9.4:/root]$ date
Tue Nov 12 13:44:20 KST 2024
[root@rocky9.4:/root]$ 

 

 

 

728x90
반응형
728x90
반응형

Rocky  리눅스 호스트 네임 변경 방법 

현재 Hostname 정보를 확인 합니다.

hostnamectl

 

[root@localhost.localdomain:/root]$ hostnamectl
   Static hostname: (unset)                           
Transient hostname: localhost
         Icon name: computer-desktop
           Chassis: desktop 🖥️
        Machine ID: 3e35814fabc440c3b52a0d066c4cb597
           Boot ID: 3cbdfef1a6dc4dbfb22d2356fd23fce8
  Operating System: Rocky Linux 9.4 (Blue Onyx)       
       CPE OS Name: cpe:/o:rocky:rocky:9::baseos
            Kernel: Linux 5.14.0-427.13.1.el9_4.x86_64
      Architecture: x86-64
   Hardware Vendor: Gigabyte Technology Co., Ltd.
    Hardware Model: B360M-D3H
  Firmware Version: F11
[root@localhost.localdomain:/root]$ 

 

변경할 Hostname 을 설정 합니다. 

 

# hostname [변경할 hostname]
hostname rocky9

 

Hostname 영구적으로 변경 

# hostnamectl set-hostname [new-hostname]
hostnamectl set-hostname rocky9.4

 

/etc/hostname 변경 

[root@rocky9.4:/root]$ vi /etc/hostname
rocky9.4

 

Rocky  리눅스 방화벽 해제 

#방화벽 중지 
systemctl stop firewalld.service 

#방화벽 영구 비활성화
systemctl disable firewalld.service 

#방화벽 상태 확인 
status firewalld

#방화벽 활성화
#systemctl start firewalld.service

 

[root@rocky9.4:/root]$ systemctl status firewalld
○ firewalld.service - firewalld - dynamic firewall daemon
     Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; preset: enabled)
     Active: inactive (dead)
       Docs: man:firewalld(1)

Nov 05 09:33:36 localhost systemd[1]: Starting firewalld - dynamic firewall daemon...
Nov 05 09:33:36 localhost systemd[1]: Started firewalld - dynamic firewall daemon.
Nov 06 19:27:56 rocky9.4 systemd[1]: Stopping firewalld - dynamic firewall daemon...
Nov 06 19:27:56 rocky9.4 systemd[1]: firewalld.service: Deactivated successfully.
Nov 06 19:27:56 rocky9.4 systemd[1]: Stopped firewalld - dynamic firewall daemon.

 

SSH Root 로그인하는 접속허용방법

  • Rocky 리눅스에서는 ssh 접속시  기본적으로 ROOT 접속을 허용 하지 않는다.
  • root 로 ssh 접속하기 위해서는 아래의 수정 사항이 필요하다.
  • /etc/ssh/sshd_config 파일을 수정 하여 PermitRootLogin yes 를 추가한다. 
  • 이후 ssh 를 재시작 한다. 
#vi /etc/ssh/sshd_config
# Authentication:

#LoginGraceTime 2m
#PermitRootLogin prohibit-password
PermitRootLogin yes

#ssh 데몬 재시작
systemctl restart sshd

 

728x90
반응형

'06.OS > Linux' 카테고리의 다른 글

[Rocky] 파일 압축 /해제 방법  (0) 2025.02.24
[Linux]Rocky 9.4 시간 변경  (0) 2024.11.13
[Rocky]Linux FileSystem Mount 정보 확인하기  (0) 2024.11.09
[문자열 검색] 문자열 찾기 방법  (0) 2024.11.08
[Linux]Curl 사용 방법  (1) 2024.09.26

+ Recent posts