Last active
September 30, 2023 09:11
-
-
Save sohag-pro/883b04b690328a74e5a09055520c8605 to your computer and use it in GitHub Desktop.
Ubuntu usefull commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Change Default php version for cli | |
sudo update-alternatives --config php | |
# Update composer to V2 | |
sudo composer self-update --2 | |
# Update composer to V1 | |
sudo composer self-update --1 | |
# Common php extensions | |
sudo apt install php7.4 php7.4-common php7.4-opcache php7.4-cli php7.4-gd php7.4-curl php7.4-mysql php7.4-mbstring php7.4-zip php7.4-xml | |
# Enable SSH tunneling | |
#0. install proxy package if not installed: npm install -g http-proxy-to-socks | |
#1. ssh -D 5001 -i key.pem user@ip | |
#2. hpts -s 127.0.0.1:5001 -p 8080 | |
#3. Go to postman settings > Proxy > Add custom proxy > 127.0.0.0.0 : 8080 > uncheck use system proxy | |
# Install PHP 8.1 | |
sudo apt install ca-certificates apt-transport-https software-properties-common | |
sudo add-apt-repository ppa:ondrej/php | |
sudo apt update | |
sudo apt install php8.1 php8.1-common php8.1-opcache php8.1-cli php8.1-gd php8.1-curl php8.1-mysql php8.1-mbstring php8.1-zip php8.1-xml | |
# MySQL User and DB | |
CREATE USER 'admin'@'localhost' IDENTIFIED BY 'password'; | |
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION; | |
FLUSH PRIVILEGES; | |
CREATE DATABASE mydatabase; | |
# Open crontab for www-data | |
crontab -u www-data -e | |
# crontab command for Laravel | |
* * * * * cd /var/www/html/ && php artisan schedule:run >> /dev/null 2>&1 | |
#PHP FPM | |
sudo apt-get install php8.1-fpm -y | |
NGINX | |
Enable Site | |
ln -s /etc/nginx/sites-available/api /etc/nginx/sites-enabled/ | |
Reload nginx | |
sudo service nginx reload | |
PHP FPM service | |
sudo service php8.1-fpm status | |
# Run Next app in PM2 | |
pm2 start npm --name "app" -- run dev | |
# install node | |
sudo apt install nodejs | |
# install npm | |
sudo apt install npm | |
# Install PM2 | |
npm install pm2 -g | |
sudo add-apt-repository ppa:ondrej/php
for 8.2 in ubuntu 22
sudo apt install mysql-server
php -S localhost:8080
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
mysqldump -u [uname] -p db_name > db_backup.sql