# [[Amazon Linux]]
Links: [[AWS]]
## Generic Setup
### Console
Console login:
https://ap-northeast-1.console.aws.amazon.com/ec2/v2/home?region=ap-northeast-1
### Choosing [[AWS]] instance type
See [[AWS Instance Types]]
### When launching instance from console
- Increase storage size; default is 8GiB
### [[Homebrew]] on [[Linux]]:
- In future, consider setting up the some of the rest using [[Homebrew]] on [[Linux]]: https://docs.brew.sh/Homebrew-on-Linux
- The rest of the instructions currently do not rely on Homebrew.
CentOS install instructions:
```bash
sudo yum groupinstall 'Development Tools'
sudo yum install procps-ng curl file git
sudo yum install libxcrypt-compat # needed by Fedora 30 and up
```
### [[Git]], [[Rust]]
```bash
sudo yum install git
# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# If anything is broken try this
# sudo yum install pkgconfig
```
### Neovim
#### Via EPEL7 (didn't work on micro instance)
(EPEL8 doesn't work)
(dependency errors after install)
```bash
# Extra Packages for Enterprise Linux (required for neovim)
# https://docs.fedoraproject.org/en-US/epel/#_quickstart
yum install [https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm](https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm)
# Install Neovim
sudo yum install -y neovim python3-neovim
mkdir -p ~/.config/nvim
```
#### Micro instance:
Source https://gist.github.com/kawaz/393c7f62fe6e857cc3d9
```bash
#!/usr/bin/env bash
sudo yum groups install -y Development\ tools
sudo yum install -y cmake
sudo yum install -y python34-{devel,pip}
sudo pip3.4 install neovim --upgrade
(
cd "$(mktemp -d)"
git clone https://github.com/neovim/neovim.git
cd neovim
make CMAKE_BUILD_TYPE=Release
sudo make install
)
```
#### C5 instance:
https://gist.github.com/MaxFangX/a5fbc53dbeb1c14cf2752bcd3cba1534
Micro instance instructions didn't work anymore
```bash
#!/usr/bin/env bash
sudo yum groups install "Development tools"
# Install cmake 3.10+, yum version 2.8.x is insufficient for neovim
sudo yum remove cmake #
sudo yum install gcc-c++ # Required for cmake
sudo yum install openssl-devel # Required for cmake
(
cd "$(mktemp -d)"
wget https://cmake.org/files/v3.21/cmake-3.21.3.tar.gz
tar -xvzf cmake-3.21.3.tar.gz
cd cmake-3.21.3
./bootstrap
make
sudo make install
)
# Check that cmake is installed correctly, may need to refresh shell
cmake --version
# Python 3.7 should already be installed, confirm
python3 --version
# Install neovim
sudo pip3.7 install neovim --upgrade
(
cd "$(mktemp -d)"
git clone https://github.com/neovim/neovim.git
cd neovim
make CMAKE_BUILD_TYPE=Release
sudo make install
)
```
### [[zsh]]
https://superuser.com/a/1389273
```bash
sudo yum install -y zsh
sudo yum install util-linux-user # Required for chsh to be available
sudo chsh -s $(which zsh) $(whoami)
```
### dotfiles
![[dotfiles#Set up dotfiles]]
### [[Oh My Zsh]]
```bash
# Install
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# Refresh from default .zshrc
source ~/.dotfiles/scripts/from-dotfiles.sh
# Refresh shell
source ~/.zshrc
```
### [[Vim Plugins]]
```bash
# Install vim-plug
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
# Run :PlugInstall
vim
```
### [[ripgrep]]
Install from [copr](https://copr.fedorainfracloud.org/coprs/carlwgeorge/ripgrep/)
```bas
sudo yum-config-manager --add-repo=https://copr.fedorainfracloud.org/coprs/carlwgeorge/ripgrep/repo/epel-7/carlwgeorge-ripgrep-epel-7.repo
sudo yum install ripgrep
```
### [[fzf]] and [[fzf-tab]]
![[fzf#Install with fzf-tab]]
### [[Rust]] build caching with [[sccache]]
Install
```bash
cargo install sccache
# Find path
which sccache
```
- If instance is e.g. micro and compilation takes forever, use a prebuilt binary; can put it inside `~/.bin`.
Add to `/home/ec2-user/.cargo/config.toml`:
```bash
vim /home/ec2-user/.cargo/config.toml
```
```toml
[build]
rustc-wrapper = "/home/ec2-user/.cargo/bin/sccache"
```
### Git ssh keys
![[Git#Set up ssh keys for remote instance]]
### From here...
Will probably clone the project repo like so:
```bash
cd ~
git clone
[email protected]:MaxFangX/Eutykhia.git tyche
```
Otherwise, the basic environment is set up.