{"id":17949930,"url":"https://github.com/haythamasalama/deploymentubuntu","last_synced_at":"2025-08-16T04:32:07.388Z","repository":{"id":164768199,"uuid":"462416534","full_name":"Haythamasalama/deploymentUbuntu","owner":"Haythamasalama","description":"🚀 Ubuntu deployment with popular technologies.","archived":false,"fork":false,"pushed_at":"2023-08-13T22:11:57.000Z","size":67,"stargazers_count":2,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-29T10:10:39.697Z","etag":null,"topics":["deployment","laravel","mysql","mysql-server","nginx","nginx-configuration","supervisor","ubuntu"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Haythamasalama.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-22T18:03:51.000Z","updated_at":"2024-01-06T19:28:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"5fb81264-e009-4898-94f9-07b7f48bf2b1","html_url":"https://github.com/Haythamasalama/deploymentUbuntu","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Haythamasalama%2FdeploymentUbuntu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Haythamasalama%2FdeploymentUbuntu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Haythamasalama%2FdeploymentUbuntu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Haythamasalama%2FdeploymentUbuntu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Haythamasalama","download_url":"https://codeload.github.com/Haythamasalama/deploymentUbuntu/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230010659,"owners_count":18159223,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deployment","laravel","mysql","mysql-server","nginx","nginx-configuration","supervisor","ubuntu"],"created_at":"2024-10-29T09:35:41.632Z","updated_at":"2024-12-16T18:39:43.341Z","avatar_url":"https://github.com/Haythamasalama.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Deployment Ubuntu \n\n- [SSH](#ssh)\n- [Nginx](#nginx)\n- [NodeJs](#nodejs)\n- [PHP 8.1](#php-81)\n- [PHP Composer](#php-composer)\n- [MySQL](#mysql)\n- [Supervisor](#supervisor)\n- [VNC](#vnc)\n\n## Before install \n```\nsudo apt-get update\n```\n\n## SSH\n  \n1- install SSH server in Ubuntu :\n```  \nsudo apt-get install openssh-server\n```  \n2 - to re-enable the service to start up at boot \n```  \nsudo systemctl enable ssh\n```\n3 - to start the service :\n```\n sudo systemctl start ssh\n```  \n4 - `haythamasalama@192.168.0.1` or ` haytham@hp-pc`\n```\nssh user@server-name  \n```\ncheck if ssh service is running :     \n```\nsudo systemctl status ssh\n```\n\u003e [More Info](https://www.cyberciti.biz/faq/ubuntu-linux-install-openssh-server/)\n\n     \n## Nginx\n\n1- install nginx :\n```\nsudo apt install nginx\n```\n2-  adjusting the Firewall : \n```\nsudo ufw allow 'Nginx Full'\n```\ncheck if nginx service is running    \n```\nsystemctl status nginx\n```\n  \n3- to re-enable the service to start up at boot :\n```\nsudo systemctl enable nginx\n```\n\nManaging the Nginx Process : \n```\nsudo systemctl start nginx\nsudo systemctl stop  nginx\nsudo systemctl restart  nginx\nsudo systemctl reload  nginx\n```\n\n\u003e [More Info](https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-20-04#step-1-installing-nginx)\n\n\n## NodeJs\n\ninstall nodejs :\n```  \ncurl -fsSL https://deb.nodesource.com/setup_17.x | sudo -E bash -\nsudo apt-get install -y nodejs\n```    \ncheck node version and if it install successfully\n``` \nnode -v \nnode –version\n``` \n\n\u003e [More Info](https://github.com/nodesource/distributions/blob/master/README.md)\n\n\n## Git\n\ninstall Git :\n``` \nsudo apt-get install git\n``` \ncheck git version and if it install successfully\n```  \ngit --version\n```       \nconfigure your Git `username` and `email` using  :\n``` \n git config --global user.name \"Haytham Salama\"\n git config --global user.email \"haythamasalama@gmail.com\"\n``` \n\n\n## PHP 8.1\n\n\u003e if you want to install php `8.0` you can change form `php8.1` to `php8.0-fpm` and all installations to `php8.1` \n\n1-  install PPA for PHP 8.1 Add the `ndrej/php` which has `PHP 8.1` package and other required PHP extensions\n\n``` \nsudo apt install software-properties-common\n```    \n```\nsudo add-apt-repository ppa:ondrej/php\n```\n    \n2- install php 8 for `nginx` : \n```\nsudo apt install php8.1-fpm\n```\n    \n2- install php 8 for `Apache` :\n```\nsudo apt install php8.1\n```    \n\n #### check if php8 service is running \n``` \nsystemctl status php8.1-fpm\n```      \n\n3- to installing PHP extension :\n\n```\nsudo apt install php8.1-[extname] \n```\n\nfor example to install `MySQL` , `GD` , `intl` , `fileinfo` ,`dom` and `curl` extensions, you would run the following command:\n```\nsudo apt install php8.1-gd php8.1-curl php8.1-intl php8.1-fileinfo php8.1-mysql  php8.1-dom\n```\n or \n```\nsudo apt install php8.1-{gd,curl,intl,fileinfo,mysql,dom}\n```\n\n\n## php composer\n\n```\nsudo apt install php-cli unzip\n``` \n\n```\ncd ~\ncurl -sS https://getcomposer.org/installer -o /tmp/composer-setup.php\nHASH=`curl -sS https://composer.github.io/installer.sig`\n```\n\ninstall composer globally and install Composer as a system-wide command named composer, under /usr/local/bin:\n```\nsudo php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer\n```\n\ncheck if composer if it install successfully\n```ssh\ncomposer\n```    \n \n\u003e [More Info](https://www.digitalocean.com/community/tutorials/how-to-install-and-use-composer-on-ubuntu-20-04#step-1-installing-php-and-additional-dependencies)\n\n\n## MySQL\n\n1- install mysql : \n```\nsudo apt install mysql-server\n```   \n2- Securing MySQL : \n```\nsudo mysql_secure_installation\n```    \n3- output for ``mysql_secure_installation`` : \n\n```\n$ Press y|Y for Yes, any other key for No:  Y \nLOW    Length \u003e= 8\nMEDIUM Length \u003e= 8, numeric, mixed case, and special characters\nSTRONG Length \u003e= 8, numeric, mixed case, special characters and dictionary  file\nPlease enter 0 = LOW, 1 = MEDIUM and 2 = STRONG:  2\n\nPlease set the password for root here.\n$ New password:\n$ Re-enter new password:\n\nEstimated strength of the password: 100\n$ Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : Y\n```\n\n    \n4- Creating a Dedicated MySQL User and Granting Privileges :  \n\n```\nsudo mysql\n```    \n\ncreate user :\n\n```mysql\nCREATE USER 'username'@'localhost' IDENTIFIED WITH mysql_native_password BY 'STRONG_PASSWORD_HERE';\nFLUSH PRIVILEGES;\n``` \n\nupdate user : \n\n```mysql\nALTER USER 'username'@'localhost' IDENTIFIED WITH mysql_native_password BY 'STRONG_PASSWORD_HERE';\nFLUSH PRIVILEGES;\n``` \n    \n5- to re-enable the service to start up at boot :\n\n```\nsudo systemctl enable mysql\n``` \n\n\n#### if you went to allow Remote Access to MySQL : \n\n  1- open config file for mysql \n  \n  ```\n  sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf\n  ```\n\n  2- after opend the config file change `bind-address` from `127.0.0.1` to  `0.0.0.0`\n\n  ```\n  . . .\n  lc-messages-dir = /usr/share/mysql\n  skip-external-locking\n  #\n  # Instead of skip-networking the default is now to listen only on\n  # localhost which is more compatible and is not less secure.\n  bind-address            = 0.0.0.0\n  . . .\n  ```\n\n  3- allow specific IP addresses on the firewall to connect to the database\n  ```\n  sudo ufw allow from remote_IP_address to any port 3306\n  ```\n  or allow `any IP address` on the firewall to connect to the database `which I do not recommend it`\n  ```\n  sudo ufw allow  3306\n  ```\n\n\ncheck if mysql service  is running :\n```\nsudo systemctl status mysql\n```\n\n\n## Supervisor\n\n```\nsudo apt-get install supervisor\n```\ngo to configuration files and create file to sotre your configrtion `file-name.conf` : \n```\ncd /etc/supervisord.conf\n```\n\n\n\nExample for config laravel queues : \n\n```\n[program:file-name]\nprocess_name=%(program_name)s_%(process_num)02d\ncommand=php /home/html/wwww/project/artisan queue:work sqs --sleep=3 --tries=3 --max-time=3600\nautostart=true\nautorestart=true\nstopasgroup=true\nkillasgroup=true\nuser=forge\nnumprocs=8\nredirect_stderr=true\nstdout_logfile=/home/html/wwww/project/worker.log\nstopwaitsecs=3600\n```\n\nStarting Supervisor : \n\n```\nsudo supervisorctl reread\n\nsudo supervisorctl update\n\nsudo supervisorctl start file-name:*\n```\n\n\u003e [More Info](http://supervisord.org/index.html)\n\n\n## VNC\n\n1- install lightdm :\n``` \nsudo apt install lightdm\n```  \n2- reboot : \n```\nsudo reboot\n```\n3- install x11vnc :\n```\nsudo apt install x11vnc\n```\n4 - open config  x11vnc service\n``` \nsudo nano /lib/systemd/system/x11vnc.service\n```\n5- Copy and paste these commands and change the password `yourPassword` to strong password\nthis password that request when you use vnc viewer  \n \n```\n[Unit]\nDescription=x11vnc service\nAfter=display-manager.service network.target syslog.target\n\n[Service]\nType=simple\nExecStart=/usr/bin/x11vnc -forever -display :0 -auth guess -passwd yourPassword\nExecStop=/usr/bin/killall x11vnc\nRestart=on-failure\n\n[Install]\nWantedBy=multi-user.target\n```\n 6 - reload\n```   \nsudo systemctl daemon-reload\n```   \n\n 7- to re-enable the service to start up at boot :\n``` \nsudo systemctl enable x11vnc.service\n```\n\n 8- to start the service :\n```          \nsudo systemctl start x11vnc.service\n``` \ncheck if x11vnc service  is running :\n``` \nsudo systemctl status x11vnc.service\n``` \nto use vnc viewer on windoes or other operating system : \n```\nhttps://www.realvnc.com/en/connect/download/viewer/\n```\n\n![image](https://user-images.githubusercontent.com/37311945/155212175-5048fa1b-0d34-4d23-943f-c955e12f0718.png)\n\n\n\u003e [Video Tutorial](https://www.youtube.com/watch?v=3K1hUwxxYek\u0026ab_channel=DavidBombal)\n\n\n## [Mote About Ubuntu](https://ubuntu.com/tutorials)\n\n## Contributing\n\nPull requests and stars are always welcome.\n\n## License\n\nCopyright © 2022, [Haytham Salama](https://github.com/haythamasalama).\nReleased under the [MIT License](LICENSE).\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaythamasalama%2Fdeploymentubuntu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhaythamasalama%2Fdeploymentubuntu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaythamasalama%2Fdeploymentubuntu/lists"}