Skip to content

Commit

Permalink
update build apk doc.
Browse files Browse the repository at this point in the history
  • Loading branch information
ericwq committed May 25, 2024
1 parent b570569 commit 0f1128a
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 20 deletions.
46 changes: 30 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,40 +18,54 @@ Before start apshd, you need to make sure you can ssh login to the target server

Note: aprilsh is still waiting for aports approval. For now please use the following private repository. The private repository only provide `x86_64` packages. Refer to [build doc](doc/build.md) to know how to build apk packages and private repositories.
```sh
wget -P /etc/apk/keys/ https://ericwq.github.io/alpine/packager-663ebf9b.rsa.pub # add public key
echo "https://ericwq.github.io/alpine/v3.19/testing" >> /etc/apk/repositories # add private repository
apk update # update repositories metadata
apk add aprilsh # install client and server
# add public key
wget -P /etc/apk/keys/ https://ericwq.github.io/alpine/packager-665145ad.rsa.pub
# add private repository
echo "https://ericwq.github.io/alpine/v3.19/testing" >> /etc/apk/repositories
# update repositories metadata
apk update
# install client and server
apk add aprilsh
```
Now you can ssh login to the server and the aprilsh is installed, it's time to start apshd server and login with apsh.
```sh
rc-service apshd start # start apshd server
apsh -m 100 eric@localhost:8022 # apsh login to server
# start apshd server
rc-service apshd start
# apsh login to server
apsh -m 100 eric@localhost:8022
# apsh login without port mapping
apsh eric@localhost

```
Note: when aports finally approve aprilsh, the above private repository will be replaced by official testing repositories. The testing repositories will provide all architecture packages.
```sh
echo "https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories # add testing repositories
# add testing repositories
echo "https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
```

### Fedora, CentOS, Redhat linux
Before start apshd, you need to make sure you can ssh login to the target server, please refer to [this doc](doc/ssh-systemd.md) to setup a ssh enabled docker container.

Note: This is a private yum/dnf repositories, it only provides `x86_64` packages. Refer to [rpms doc](https://codeberg.org/ericwq/rpms#build-rpm-packages) to understand how to build rpm packags and dnf repositories.
```sh
rpm --import https://ericwq.codeberg.page/RPM-GPG-KEY-wangqi # import public key to rpm DB
dnf config-manager --add-repo https://ericwq.codeberg.page/aprilsh.repo # add new repo to dnf repository
dnf install -y aprilsh # install client and server
# import public key to rpm DB
rpm --import https://ericwq.codeberg.page/RPM-GPG-KEY-wangqi
# add new repo to dnf repository
dnf config-manager --add-repo https://ericwq.codeberg.page/aprilsh.repo
# install client and server
dnf install -y aprilsh
```
Now you can ssh login to the server, it's time to start apshd service and login with apsh.
```sh
sudo systemctl start apshd.service #start apshd service
sudo journalctl -f -u apshd.service #keep reading the latest apshd.service log
apsh -m 100 eric@localhost:8022 # apsh login to server
sudo systemctl start apshd.service # start apshd service
sudo journalctl -f -u apshd.service # keep reading the latest apshd.service log
apsh -m 100 packager@localhost:8022 # apsh login to server
apsh packager@localhost # apsh login without port mapping
```
### MacOS
```sh
brew tap ericwq/utils # add tap to homebrew
brew install aprilsh # only install aprilsh client
brew tap ericwq/utils # add tap to homebrew
brew install aprilsh # only install aprilsh client
```
Refer to [homebrew doc](https://github.com/ericwq/homebrew-utils) to know how to create homebrew package and tap.
### Validate installation
Expand All @@ -73,7 +87,7 @@ Powered by neovim, luals, gopls and clangd.
ide@openrc-nvide:~ $
```
if you login on two terminals, on the server, there will be two server processes serve the clients. the following shows `apshd` serve two clients. one is`:8101`, the other is ':8102'
```sh
```txt
openrc:~# netstat -lp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
Expand Down
1 change: 1 addition & 0 deletions build/abuild.dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
FROM alpine:3.19
LABEL maintainer="[email protected]"
LABEL build_date="2024-05-25"

#
RUN apk add --no-cache --update alpine-sdk sudo mandoc abuild-doc tzdata atools
Expand Down
5 changes: 2 additions & 3 deletions build/systemd.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ LABEL build_date="2024-05-24"
# add sssd to avoid warning:
# PAM unable to dlopen(/usr/lib64/security/pam_sss.so): /usr/lib64/security/pam_sss.so: cannot open shared object file: No such file or directory
# PAM adding faulty module: /usr/lib64/security/pam_sss.so
RUN dnf -y install bash coreutils diffutils \
sudo dnf-plugins-core tree git wget which ripgrep fzf pkgconfig \
net-tools htop openssh-server sssd \
RUN dnf -y install bash coreutils diffutils net-tools htop openssh-server sssd \
sudo dnf-plugins-core tree git wget which ripgrep fzf \
&& dnf clean all

# add user/group
Expand Down
4 changes: 3 additions & 1 deletion doc/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The container install `alpine-sdk sudo atools` packages, create `packager` user,
docker build -t abuild:0.1.0 -f abuild.dockerfile .
docker build --no-cache --progress plain -t abuild:0.1.0 -f abuild.dockerfile .
```
if you update abuild keys, remember back up the keys.

run as root
```sh
docker run -u root --rm -ti -h abuild --env TZ=Asia/Shanghai --name abuild --privileged \
Expand Down Expand Up @@ -34,11 +36,11 @@ sudo apk add go protoc utmps-dev ncurses-terminfo musl-locales protoc-gen-go col
cd ~/aports
git config pull.rebase true # rebase pull
git pull # get latest update
git branch -a # list all branches
git checkout aprilsh # switch to branch
git branch aprilsh # create branch
git branch -d aprilsh # delete local branch
git push origin -d aprilsh # delete remote branch
git branch -a # list all branches
```
<!-- https://www.freecodecamp.org/news/git-delete-remote-branch/ -->
create aprilsh directory if we don't have it.
Expand Down
7 changes: 7 additions & 0 deletions doc/ssh-systemd.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ docker run --env TZ=Asia/Shanghai --tty --privileged \
--volume /sys/fs/cgroup:/sys/fs/cgroup:rw \
--hostname systemd --name systemd -d -p 8022:22 \
-p 8201:8101/udp -p 8202:8102/udp -p 8203:8103/udp systemd:0.1.0
```
get into the container
```sh
docker exec -u root -it systemd bash
```
### check local ssh key
Expand All @@ -40,6 +43,10 @@ if you don't have any ssh keys, run the following command to generate it.
ssh-keygen -t ed25519
ssh-keygen -t rsa
```
clean knowhost
```sh
rm ~/.ssh/known_hosts*
```
### add rsa key to ssh agent
Here is my ssh version:
- ssh client: OpenSSH_9.0p1, LibreSSL 3.3.6
Expand Down

0 comments on commit 0f1128a

Please sign in to comment.