Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes #5

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 27 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,35 @@
FROM node:16

RUN apt update

RUN apt install openssh-server sudo curl nano git -y

RUN apt install libssl-dev libudev-dev pkg-config zlib1g-dev llvm clang make -y

RUN useradd -rm -d /home/ubuntu -s /bin/bash -g root -G sudo -u 1010 sshuser

RUN usermod -aG sudo sshuser

# Install necessary packages
RUN apt update && \
apt install -y \
openssh-server \
sudo \
curl \
nano \
git \
libssl-dev \
libudev-dev \
pkg-config \
zlib1g-dev \
llvm \
clang \
make \
&& rm -rf /var/lib/apt/lists/*

# Create a non-root user for SSH
RUN useradd -rm -d /home/ubuntu -s /bin/bash -u 1010 sshuser && \
echo 'sshuser:password' | chpasswd && \
usermod -aG sudo sshuser

# Start SSH service
RUN service ssh start

RUN echo 'sshuser:password' | chpasswd

# Copy Solana install script
COPY solana-install.sh /home/ubuntu

# Expose SSH port
EXPOSE 22

CMD ["/usr/sbin/sshd","-D"]
# Start SSH daemon
CMD ["/usr/sbin/sshd", "-D"]
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,18 @@ Ports open:


# How to use
* Make sure docker + docker-compose are on your machine. You can get them at docker.com
* Make sure docker + docker-compose are on your machine. You can get them at [docker.com](https://docs.docker.com/get-docker/)
* Download (and unzip) or clone this repo to your machine.
* Open a terminal in the folder where the files are.
* Type `docker-compose build` and hit enter to start the build process.
* Type `docker-compose up -d` to start running the container when it's done building.
* Use ssh to log in to the container.. `ssh sshuser@127.0.0.1`, the password is `password`
* Once in the container, type `./solana-install.sh` and enter `password` again when prompted.
* Once in the container, type `sudo ./solana-install.sh` and enter `password` again when prompted.
* Follow any prompts and then wait until it's done.
* Type `exit` to leave the ssh session, then reconnect to begin playing with solana.
* (if you want to stop the container, type `docker-compose down` once you have exited ssh)

# Troubleshooting
### I get `-bash: ./solana-install.sh: /bin/bash^M: bad interpreter: No such file or directory` when I try to run the solana-install.sh
That's an issue with the line returns on the file.. just run this `sed -i -e 's/\r$//' solana-install.sh` to fix the file, and try again.
1) I get `-bash: ./solana-install.sh: /bin/bash: bad interpreter: No such file or directory` when I try to run the solana-install.sh
<br>
That's an issue with the line returns on the file. Just run this `sed -i -e 's/\r$//' solana-install.sh` to fix the file, and try again.
25 changes: 20 additions & 5 deletions solana-install.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
#!/bin/bash
sudo curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh

# Install Rust
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh
source $HOME/.cargo/env

# Install Solana
sh -c "$(curl -sSfL https://release.solana.com/v1.10.4/install)"
export PATH="/home/ubuntu/.local/share/solana/install/active_release/bin:$PATH"
sudo npm install -g mocha
sudo npm install -g ts_node
export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"

# Install npm packages globally
npm install -g mocha ts-node

# Install Anchor CLI
cargo install --git https://github.com/project-serum/anchor anchor-cli --locked

# Verify Solana installation
solana --version

# Configure Solana
solana config set --url localhost
solana config get
solana config get

# Clean up
rm -rf $HOME/.cargo/registry # Remove cargo registry cache
apt-get clean # Clean up apt cache