Skip to content

Instantly share code, notes, and snippets.

@goldcoders
Created December 19, 2019 08:48
Show Gist options
  • Select an option

  • Save goldcoders/5e9022950f3d07ddd3d87e657c98808c to your computer and use it in GitHub Desktop.

Select an option

Save goldcoders/5e9022950f3d07ddd3d87e657c98808c to your computer and use it in GitHub Desktop.
https://www.vultr.com/docs/how-to-install-mariadb-10-3-or-mysql-8-0-on-arch-linux
pacman -S mariadb
sudo systemctl enable mysqld
pacman -S php nginx redis php-fpm composer
sudo systemctl enable nginx
sudo systemctl enable redis
sudo systemctl enable php-fpm
install yay
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
yay -Y php-gd
yay -Y php-sqlite
add to path composer
vim .bashrc
export PATH=$PATH:$HOME/.composer/vendor/bin
enable php extension
check all php extension available in arch
sudo pacman -Ss | grep php
php --ini
uncomment
pdo_mysql
pdo_msyqli
iconv
gd
exif
curl
sqlite3
configure nginx
copy this from
https://laravel.com/docs/6.x/deployment
paste on your default nginx.conf or create a new enabled site
```
server {
listen 80;
server_name localhost;
root /var/www/goldcoders/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
```
install laravel installer
cd /var
mkdir www
sudo chown -R $(whoami) www/
laravel new goldcoders
cd goldcoders
cp .env.example .env
vim .env
edit Database Config
sudo chown -R 777 storage/
php artisan storage:link
php artisan migrate:fresh --seed
Set Up Custom Domain Name
go to Godaddy Point DNS server to
ns1.vultr.com
ns2.vultr.com
log in to you vultr account
my.vultr.com/dns
Click Add Domain
Check Your Droplet IP address
fill it up with your domain and ip address
Add New Site
with this script
https://www.tecmint.com/create-virtual-hosts-using-nginx-on-arch-linux/
n2ensite.sh
```
#!/bin/bash
if test -d /etc/nginx/sites-available && test -d /etc/nginx/sites-enabled ; then
echo "-----------------------------------------------"
else
mkdir /etc/nginx/sites-available
mkdir /etc/nginx/sites-enabled
fi
avail=/etc/nginx/sites-available/$1.conf
enabled=/etc/nginx/sites-enabled/
site=`ls /etc/nginx/sites-available/`
if [ "$#" != "1" ]; then
echo "Use script: n2ensite virtual_site"
echo -e "\nAvailable virtual hosts:\n$site"
exit 0
else
if test -e $avail; then
sudo ln -s $avail $enabled
else
echo -e "$avail virtual host does not exist! Please create one!\n$site"
exit 0
fi
if test -e $enabled/$1.conf; then
echo "Success!! Now restart nginx server: sudo systemctl restart nginx"
else
echo -e "Virtual host $avail does not exist!\nPlease see available virtual hosts:\n$site"
exit 0
fi
fi
```
n2dissite.sh
```
#!/bin/bash
avail=/etc/nginx/sites-enabled/$1.conf
enabled=/etc/nginx/sites-enabled
site=`ls /etc/nginx/sites-enabled/`
if [ "$#" != "1" ]; then
echo "Use script: n2dissite virtual_site"
echo -e "\nAvailable virtual hosts: \n$site"
exit 0
else
if test -e $avail; then
sudo rm $avail
else
echo -e "$avail virtual host does not exist! Exiting!"
exit 0
fi
if test -e $enabled/$1.conf; then
echo "Error!! Could not remove $avail virtual host!"
else
echo -e "Success! $avail has been removed!\nPlease restart Nginx: sudo systemctl restart nginx"
exit 0
fi
fi
```
sudo cp n2ensite n2dissite /usr/local/bin/
passwd uriah
useradd --create-home --groups wheel uriah
visudo -c -f /etc/sudoers.new && mv /etc/sudoers.new /etc/sudoers
sed 's/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/' -i /etc/sudoers.new
cp /etc/sudoers /etc/sudoers.new
grub-mkconfig -o /boot/grub/grub.cfg
grub-install /dev/vda
pacman -S grub
mkinitcpio -p linux
vim /etc/mkinitcpio.conf
Locate MODULES="..." and add btrfs into the list
# Set PermitRootLogin yes
vim /etc/ssh/sshd_config
echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
systemctl enable sshd
pacman -S openssh
passwd
vim /etc/hosts
127.0.0.1 localhost
::1 localhost
127.0.1.1 myhostname.localdomain myhostname
echo 'archway' > /etc/hostname
systemctl enable NetworkManager
pacman -S networkmanager
echo 'LANG=en_US.UTF-8' > /etc/locale.conf
locale-gen
sed 's/#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' -i /etc/locale.gen
hwclock --systohc
ln -sf /usr/share/zoneinfo/Asia/Manila /etc/localtime
arch-chroot /mnt
genfstab -L /mnt >> /mnt/etc/fstab
pacstrap /mnt linux
pacstrap /mnt base btrfs-progs base-devel vim
mount /dev/vda1 /mnt
mkfs.btrfs -f --label ROOT /dev/vda1
pacman -Sy archlinux-keyring
cfdisk /dev/vda
Accept the new host for your known_hosts list by answering yes.
If you get an error with the problem of too many authentication failures like below.
Received disconnect from ip-address port 22:2: Too many authentication failures
Disconnected from ip-address port 22
Use the following command instead to attempt to authenticate properly.
ssh -o IdentitiesOnly=yes root@ip-address
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment