# Solana Metaplex Candy Machine All in One Tutorial ###### System: Linux Ubuntu 20.4 LTS + Docker; installed on linux server and ssh from mac ##### --- **Attention!: Add 'sudo' to 'apt install' command if you are using Linux native not docker** --- # A.Installation ### 1. Start Docker ###### `sudo docker run -i -t ubuntu /bin/bash` ### 2. Install Nodejs #### 1)Update `apt-get update` #### 2)Install curl `apt-get install curl` #### 3)Get install script and pass it to execute: `curl -sL https://deb.nodesource.com/setup_14.x | bash` #### 4) and install node `apt-get install nodejs` #### 5) confirm that it was successful `node -v` `npm -v` ### 3. Install Rustc `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh ` ###### reference:https://www.rust-lang.org/tools/install && https://rustup.rs/ ### 4. Install Yarn `curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add` `echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list` `apt update` ` apt install yarn` ###### refence: https://linuxize.com/post/how-to-install-yarn-on-ubuntu-20-04/ ### 5. Install node version manager #### 5.1 Method 1: Install n `curl -L https://raw.githubusercontent.com/tj/n/master/bin/n -o n` #### if nodejs not installed you can also use this command to install the latest version `bash n lts ` ###### reference :https://github.com/tj/n#installation #### 5.2 Method 2: NVM Or you have install nvm as node version manager using: ``` sudo apt install -y curl curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash ``` `source ~/.profile ` --- ##### **Hope it works.If this does not work**: ##### Go to the website copy paste and generate a new file named install.sh. Then run the shell script ` chmod +x /path/to/yourscript.sh /path/to/yourscript.sh` `source ~/.profile ` ##### when using nvm to install nodejs new version, command is: ` nvm install 14.17.6` ##### You can assign the version of node by `nvm use 14.x.x` ### 6. Install Solana #### 6.1 Method 1 `sh -c "$(curl -sSfL https://release.solana.com/v1.8.1/install)"` The output should be: ``` downloading v1.8.1 installer Configuration: /home/solana/.config/solana/install/config.yml Active release directory: /home/solana/.local/share/solana/install/active_release * Release version: v1.8.1 * Release URL: https://github.com/solana-labs/solana/releases/download/v1.8.1/solana-release-x86_64-unknown-linux-gnu.tar.bz2 Update successful ``` Set env variable `export PATH="/home/ubuntu/.local/share/solana/install/active_release/bin:$PATH"` `source ~/.profile` check solana version `solana --version` I haven't tried this in Linux, sucessfully on mac. Let me know if any problem exists. ###### reference: https://lightcycle.xyz/zero-to-solana-first-metaplex/ If this does not work, try binary Method: #### 6.2 Method 2 Download the binaries by navigating to https://github.com/solana-labs/solana/releases/latest, download solana-release-x86_64-unknown-linux-msvc.tar.bz2, then extract the archive: `tar jxf solana-release-x86_64-unknown-linux-gnu.tar.bz2` `cd solana-release/` `export PATH=$PWD/bin:$PATH` This method has the problem that I need to run cd and export everytime I go into the system. But this is recommended in Official Doc. --- The first method does not work for me, the output shows network issue. So I download the binary locally and "ssh scp " copy the file to docker Method to copy file to docker from local: `docker cp solana-release-x86_64-unknown-linux-gnu.tar.bz2 <docker-id>:/solana-release-x86_64-unknown-linux-gnu.tar.bz2` copy file local to linux server / `scp /local/dir/file.txt username@remoteHost:/remote/dir/file.txt` ###### reference:https://www.simplified.guide/ssh/copy-file copy folder local to linux server `scp -r /local/dir/ username@remoteHost:/remote/dir` ###### reference:https://blog.chapagain.com.np/ssh-scp-copy-files-folders-from-local-to-remote-remote-to-local/` How to check docker id: 1) the root@xxxxx on the command line. The series of number behind root is your docker id. ###### reference:https://docs.solana.com/cli/install-solana-cli-tools ### 7. Install Metaplex 1. #### Git clone repo `git clone https://github.com/metaplex-foundation/metaplex.git 2. #### Get into the cli directory `cd metaplex/js/packages/cli` 3. #### yarn commands ``` yarn install yarn bootstrap yarn build ``` I am not sure about this part actually. (Still trying to figure out.) I do not have error executing these, but I can't get metaplex command up. ### 8.Fix Errors: Install Some Dependencies ##### I had problem running part 7 (yarn install) ##### The error message said something like: `npm ERR! node-pre-gyp` `gyp ERR! find Python You need to install the latest version of Python.` `canvas/releases/download/v2.8.0/canvas-v2.8.0-node-v83-linux-glibc-x64.tar.gz failed, reason: socket hang up ` clearly I am missing something called node-pre-gyp, a package. And when I look at its github it said: ``` Depending on your operating system, you will need to install: On Unix Python v3.6, v3.7, v3.8, or v3.9 make A proper C/C++ compiler toolchain, like GCC ``` So I installed these 3 things correctly. During this process my docker told me there is not enough space, I autocleaned the system and docker (according to google search resulted commands, which I do not recommend). After I installed the dependencies, I installed node-pre-gyp using: `npm install -g node-gyp` Sometimes I have other issues, if you encounter other errors, just read the logs, it usually ask you to install some dependencies. Maybe because the network is timeout, or the script is not correctly. Just do it manually. Look from upper to the bottom, everytime you fix something , try the command to see how things goes.You don't have to fix everything at once. ###### (referece:https://github.com/nodejs/node-gyp#installation) ### 9. Fix Error: Path variable I had many installations and cannot find command It is because of the path variable. check this post https://janelbrandon.medium.com/understanding-the-path-variable-6eae0936e976 I will go back to this later --- # B. Try Candy Machine ###### reference:https://docs.metaplex.com/create-candy/introduction ### 1. Fund Solana Wallet You cannot use airdrop function if you are using Quicknode RPC. Transfer Money ` solana transfer --from /home/lx/.config/solana/devnet.json EgEa3AaCeMTf7uTPEQPeqjMHHytvvrcsWnH6UCLye3jy 2 --allow-unfunded-recipient --url <rpc address> --fee-payer /home/lx/.config/solana/devnet.json ` Metaplex Standard "creators": [{ "address": "2tbqozqRD6WhoZuyFfS8Mudsw7MomJBTWmUmM127wGMr", "share": 100 } ] Upload `ts-node ~/develop/metaplex/js/packages/cli/src/candy-machine-cli.ts upload ./example-assets --env devnet --keypair /home/lx/.config/solana/devnet.json -s ipfs --ipfs-infura-project-id 1zG33gQbT3YB6b1mEdHeLZteBc8 --ipfs-infura-secret b6a98438b0265046f05b9266bcded05f` Verify `ts-node ~/develop/metaplex/js/packages/cli/src/candy-machine-cli.ts verify --keypair /home/lx/.config/solana/devnet.json` `npx ts-node /metaplex/js/packages/cli/src/candy-machine-cli.ts verify --keypair ~/.config/solana/devnet.json`