Quay lại

Hướng dẫn cài đặt Jenkins trên AWS EC2 Ubuntu 22.04 instance - 2024 Chuyên mục Devops    2024-05-11    19 Lượt xem    19 Lượt thích    comment-3 Created with Sketch Beta. 0 Bình luận

Hướng dẫn cài đặt Jenkins trên AWS EC2 Ubuntu 22.04 instance - 2024

Giới thiệu

Jenkins là một máy chủ tự động hóa mã nguồn mở giúp tự động hóa các giai đoạn khác nhau của quy trình phát triển phần mềm. Nó chủ yếu được sử dụng cho các đường ống CI/CD (Continuous Integration and Continuous Delivery/Deployment), cho phép các nhà phát triển xây dựng, kiểm thử và triển khai mã của họ nhanh chóng lên môi trường sản xuất.

AWS (Amazon Web Services) là một nền tảng cloud computing cung cấp một loạt các dịch vụ cho các nhà phát triển và doanh nghiệp xây dựng và triển khai ứng dụng trên đám mây. AWS có một loạt các dịch vụ, bao gồm tính toán, lưu trữ, cơ sở dữ liệu, mạng và học máy.

Hướng dẫn từng bước để cài đặt Jenkins trên một instance AWS EC2 Ubuntu 22.04:

Step 1: Update and Upgrade the System

sudo apt update && sudo apt upgrade -y

Step 2: Install Java (Required for Jenkins)

Jenkins requires Java. Install OpenJDK 17:

sudo apt install -y openjdk-17-jdk​

Verify Java installation:

java -version​

Step 3: Add Jenkins Repository

wget -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo tee /usr/share/keyrings/jenkins-keyring.asc > /dev/null
echo "deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] https://pkg.jenkins.io/debian-stable binary/" | sudo tee /etc/apt/sources.list.d/jenkins.list > /dev/null​

Step 4: Install Jenkins

sudo apt update
sudo apt install -y jenkins​

Step 5: Start and Enable Jenkins Service

sudo systemctl start jenkins
sudo systemctl enable jenkins​

Check Jenkins status:

sudo systemctl status jenkins​

Step 6: Allow Jenkins Through Firewall

If using UFW (Uncomplicated Firewall):

sudo ufw allow 8080
sudo ufw enable
sudo ufw status​

If using AWS Security Groups, allow inbound traffic on port 8080.

Step 7: Get Initial Admin Password

sudo cat /var/lib/jenkins/secrets/initialAdminPassword​

Copy this password for Jenkins setup.

Step 8: Access Jenkins Web Interface

  • Open a browser and go to:
     
    http://your-ec2-public-ip:8080​
  • Enter the initial admin password.
  • Follow the setup wizard to install recommended plugins and create an admin user.

Step 9: (Optional) Change Jenkins Port

To run Jenkins on a different port (e.g., 9090):

sudo nano /etc/default/jenkins​

Find HTTP_PORT=8080 and change it to:

HTTP_PORT=9090​

Restart Jenkins:

sudo systemctl restart jenkins

Kết luận

Việc thêm các khóa chữ ký bộ lưu trữ vào các gói cài đặt Linux là một biện pháp bảo mật quan trọng đảm bảo tính xác thực và tính toàn vẹn của các gói được cài đặt trên hệ thống của bạn. Bằng cách xác minh chữ ký của gói bằng khóa chữ ký bộ lưu trữ, bạn có thể chắc chắn rằng gói không bị can thiệp hoặc sửa đổi theo bất kỳ cách nào.

Bình luận (0)

Michael Gough
Michael Gough
Michael Gough
Michael Gough
Michael Gough
Michael Gough
Michael Gough
Michael Gough
Michael Gough
Michael Gough
Michael Gough
Michael Gough
Michael Gough
Michael Gough
Michael Gough
Michael Gough

Bài viết liên quan

Learning English Everyday