韭菜系列寫到第十七篇,發現要做的事情還很多⋯,所以接下來要把前面開發好的程式碼,放到一個地方一直跑。
基於目前還在開發階段,所以我選擇使用一台虛擬主機來進行我們實驗。
chmod 400 xxx.pem
ssh -i 金鑰名稱.pem ubuntu@xxx.xxx.xxx.43
sudo apt-get update
sudo apt-get install git
curl https://pyenv.run | bash
ubuntu@ip-172-31-132-147:~$ curl https://pyenv.run | bash
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 270 100 270 0 0 1254 0 --:--:-- --:--:-- --:--:-- 1250
Cloning into '/home/ubuntu/.pyenv'...
remote: Enumerating objects: 1284, done.
remote: Counting objects: 100% (1284/1284), done.
remote: Compressing objects: 100% (708/708), done.
remote: Total 1284 (delta 757), reused 744 (delta 443), pack-reused 0 (from 0)
Receiving objects: 100% (1284/1284), 635.05 KiB | 2.62 MiB/s, done.
Resolving deltas: 100% (757/757), done.
Cloning into '/home/ubuntu/.pyenv/plugins/pyenv-doctor'...
remote: Enumerating objects: 11, done.
remote: Counting objects: 100% (11/11), done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 11 (delta 1), reused 5 (delta 0), pack-reused 0 (from 0)
Receiving objects: 100% (11/11), 38.72 KiB | 38.72 MiB/s, done.
Resolving deltas: 100% (1/1), done.
Cloning into '/home/ubuntu/.pyenv/plugins/pyenv-update'...
remote: Enumerating objects: 10, done.
remote: Counting objects: 100% (10/10), done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 10 (delta 1), reused 5 (delta 0), pack-reused 0 (from 0)
Receiving objects: 100% (10/10), done.
Resolving deltas: 100% (1/1), done.
Cloning into '/home/ubuntu/.pyenv/plugins/pyenv-virtualenv'...
remote: Enumerating objects: 64, done.
remote: Counting objects: 100% (64/64), done.
remote: Compressing objects: 100% (56/56), done.
remote: Total 64 (delta 10), reused 25 (delta 1), pack-reused 0 (from 0)
Receiving objects: 100% (64/64), 42.89 KiB | 1.26 MiB/s, done.
Resolving deltas: 100% (10/10), done.
WARNING: seems you still have not added 'pyenv' to the load path.
# Load pyenv automatically by appending
# the following to
# ~/.bash_profile if it exists, otherwise ~/.profile (for login shells)
# and ~/.bashrc (for interactive shells) :
export PYENV_ROOT="$HOME/.pyenv"
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
# Restart your shell for the changes to take effect.
# Load pyenv-virtualenv automatically by adding
# the following to ~/.bashrc:
eval "$(pyenv virtualenv-init -)"
pyenv
還需要夾到 load pathsudo apt update
sudo apt install redis-tools # for redis-cli
sudo snap install redis
ubuntu@ip-172-31-132-147:~$ sudo apt install redis-tools
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
libatomic1 libjemalloc2 liblzf1
Suggested packages:
ruby-redis
The following NEW packages will be installed:
libatomic1 libjemalloc2 liblzf1 redis-tools
0 upgraded, 4 newly installed, 0 to remove and 20 not upgraded.
Need to get 1440 kB of archives.
After this operation, 7418 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu noble/main amd64 libatomic1 amd64 14-20240412-0ubuntu1 [10.4 kB]
Get:2 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu noble/universe amd64 libjemalloc2 amd64 5.3.0-2build1 [256 kB]
Get:3 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu noble/universe amd64 liblzf1 amd64 3.6-4 [7624 B]
Get:4 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu noble/universe amd64 redis-tools amd64 5:7.0.15-1build2 [1165 kB]
Fetched 1440 kB in 1s (1365 kB/s)
Selecting previously unselected package libatomic1:amd64.
(Reading database ... 104525 files and directories currently installed.)
Preparing to unpack .../libatomic1_14-20240412-0ubuntu1_amd64.deb ...
Unpacking libatomic1:amd64 (14-20240412-0ubuntu1) ...
Selecting previously unselected package libjemalloc2:amd64.
Preparing to unpack .../libjemalloc2_5.3.0-2build1_amd64.deb ...
Unpacking libjemalloc2:amd64 (5.3.0-2build1) ...
Selecting previously unselected package liblzf1:amd64.
Preparing to unpack .../liblzf1_3.6-4_amd64.deb ...
Unpacking liblzf1:amd64 (3.6-4) ...
Selecting previously unselected package redis-tools.
Preparing to unpack .../redis-tools_5%3a7.0.15-1build2_amd64.deb ...
Unpacking redis-tools (5:7.0.15-1build2) ...
Setting up libjemalloc2:amd64 (5.3.0-2build1) ...
Setting up liblzf1:amd64 (3.6-4) ...
Setting up libatomic1:amd64 (14-20240412-0ubuntu1) ...
Setting up redis-tools (5:7.0.15-1build2) ...
Processing triggers for man-db (2.12.0-4build2) ...
Processing triggers for libc-bin (2.39-0ubuntu8.3) ...
Scanning processes...
Scanning candidates...
Scanning linux images...
Pending kernel upgrade!
Running kernel version:
6.8.0-1012-aws
Diagnostics:
The currently running kernel version is not the expected kernel version 6.8.0-1016-aws.
Restarting the system to load the new kernel will not be handled automatically, so you should consider rebooting.
Restarting services...
Service restarts being deferred:
systemctl restart networkd-dispatcher.service
systemctl restart unattended-upgrades.service
No containers need to be restarted.
No user sessions are running outdated binaries.
No VM guests are running outdated hypervisor (qemu) binaries on this host.
sudo snap install redis
redis-cli
指令測試 Redis 服務有沒有起來;如果有,就可以用 Ctrl+C 離開ubuntu@ip-172-31-132-147:~$ redis-cli
127.0.0.1:6379>
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
unzip awscliv2.zip
sudo ./aws/install
ubuntu@ip-172-31-132-147:~$ sudo ./aws/install
You can now run: /usr/local/bin/aws --version
ubuntu@ip-172-31-132-147:~$ /usr/local/bin/aws --version
aws-cli/2.17.62 Python/3.12.6 Linux/6.8.0-1012-aws exe/x86_64.ubuntu.24