This commit is contained in:
mustafa 2025-04-09 10:17:16 +03:30
parent 47a50c7f0d
commit 15794d8ca3
33 changed files with 3473 additions and 0 deletions

155
0-Check List/list.md Normal file
View File

@ -0,0 +1,155 @@
<p dir="rtl" align="center">بسم الله الرحمن الرحیم</p>
<p align="right" dir="rtl">
نصب برنامه ها و بسته های نرم افزاری و سرویسهای لازم برای راه اندازی سرور و سرویسهای زیرمجموعه gateway
</p>
# <p align="right" dir="rtl">گام اول-نصب PHP</p>
```r
sudo apt-get install --dry-run php
```
```r
sudo apt update && sudo apt -y upgrade
```
```r
sudo apt autoremove
```
```r
[ -f /var/run/reboot-required ] && sudo reboot -f
```
<p align="right" dir="rtl">جزئیات انتشار سیستم عامل را می توان با استفاده از دستورات داده شده در اینجا بررسی کرد.</p>
```r
cat /etc/os-release
```
```r
sudo apt install -y lsb-release gnupg2 ca-certificates apt-transport-https software-properties-common
```
```r
sudo add-apt-repository ppa:ondrej/php
```
```r
sudo apt update
```
```r
sudo apt install php8.2
```
```r
php -v
```
# <p align="right" dir="rtl">گام دوم-نصب MariaDB</p>
```r
sudo apt install mariadb-server mariadb-client
sudo mysql_secure_installation
sudo mariadb
```
# <p align="right" dir="rtl">گام سوم-نصب Webserver</p>
<p align="right" dir="rtl">
<span style="background-color:rgb(255,255,0);color:red;font:bold;">
توجه:
</span>
<br>
یکی از این وب سرورها (Apache یا Nginx) باید نصب شود و دیگری بایستی غیر فعال گردد، چون امکان تداخل وجود دارد و این تداخل در روند کار اختلال ایجاد می کند.
</p>
# <p align="right" dir="rtl">1-Apache</p>
```r
sudo apt update
sudo apt install apache2
sudo systemctl start apache2
sudo systemctl enable apache2
sudo systemctl status apache2
```
# <p align="right" dir="rtl">2-Nginx</p>
```r
sudo apt update
sudo apt install nginx
sudo systemctl start nginx
sudo systemctl enable nginx
sudo systemctl status nginx
```
# <p align="right" dir="rtl">گام چهارم-نصب Elasticsearch</p>
## <p align="right" dir="rtl">1-نصب java</p>
```r
sudo apt install openjdk-11-jdk
```
<p dir="rtl" align="right">برای تعریف متغیر محیطی فایل زیر را باز کنید: </p>
```r
sudo nano /etc/environment
```
<p dir="rtl" align="right">متغیر زیر را در فایل قرار دهید: </p>
```r
JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"
```
<p dir="rtl" align="right">متغیر محیطی یا environment را با استفاده از دستور زیر بارگذاری کنید</p>
```r
source /etc/environment
```
## <p dir="rtl" align="right"> 2-نصب ElasticSearch 8 در Ubuntu 20.04 LTS </p>
<p dir="rtl" align="right">کلید امضای عمومی را دانلود و نصب کنید، اگر می‌خواهید آخرین Elasticsearch را دانلود کنید، به صفحه دانلود رسمی Elastic Stack مراجعه کنید.</p>
```r
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /usr/share/keyrings/elasticsearch-keyring.gpg
```
<p dir="rtl" align="right">تعریف مخزن را در این فایل ذخیره کنید: /etc/apt/sources.list.d/elastic-8.x.list:</p>
```r
echo "deb [signed-by=/usr/share/keyrings/elasticsearch-keyring.gpg] https://artifacts.elastic.co/packages/8.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-8.x.list
```
```r
sudo apt-get update
sudo apt-get install elasticsearch
sudo systemctl start elasticsearch
sudo systemctl enable elasticsearch
sudo systemctl status elasticsearch
```
<p dir="rtl" align="right"> تنظیمات فایل پیکربندی</p>
```r
sudo nano /etc/elasticsearch/elasticsearch.yml
```
<p dir="rtl" align="right"> به بخش Network بروید و network.host را از نظر خارج کنید و IP سیستم خود را جایگزین کنید</p>
```r
network.host: 0.0.0.0
```
<p dir="rtl" align="center">صلوات</p>

View File

@ -0,0 +1,55 @@
<div dir="rtl" align="right">
<p dir="rtl" align="center">بسم الله الرحمن الرحیم </p>
حل مشکل Temporary failure resolving هنگام آپدیت در Ubuntu
<div dir="ltr" align="left" style="background-color:black;color:white">
<p style="background-color:black;color:white;">
<code>
Err:1 http://security.ubuntu.com/ubuntu xenial-security InRelease Temporary failure resolving security.ubuntu.com
Err:2 http://archive.ubuntu.com/ubuntu xenial InRelease Temporary failure resolving archive.ubuntu.com
Err:3 http://archive.ubuntu.com/ubuntu xenial-updates InRelease Temporary failure resolving archive.ubuntu.comReading package lists… DoneW: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial/InRelease Temporary failure resolving archive.ubuntu.com'W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-updates/InRelease Temporary failure resolving archive.ubuntu.com'W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/InRelease Temporary failure resolving security.ubuntu.com'W: Some
index files failed to download.
They have been ignored, or old ones used instead
...
</code>
</p>
</div>
دستور زیر را در خط فرمان اجرا کنید:
<div dir="ltr" align="left">
```r
sudo nano /etc/resolv.conf
```
</div>
nameserver را تغییر دهید و یا کپی کنید:
<div dir="ltr" align="left">
```r
nameserver 8.8.8.8
nameserver 4.2.2.4
```
</div>
یا به طور خلاصه در یک خط:
<div dir="ltr" align="left">
```r
echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf > /dev/null
```
</div>
<p dir="rtl" align="center">صلوات</p>
</div>

163
1-Ubuntu/0-minimal.md Normal file
View File

@ -0,0 +1,163 @@
<p dir="rtl" align="center">بسم الله الرحمن الرحیم</p>
# <p align="right" dir="rtl">بررسی بسته های نصب شده روی سرور</p>
```r
apt list --installed
```
<p align="right" dir="rtl">
بررسی بسته های نصب شده روی سرور از یک سرویس خاص مثل(آپاچی):
</p>
```r
apt list apache2
```
<p align="right" dir="rtl">
بررسی همه نسخه های بسته های نصب شده روی سرور از یک سرویس خاص مثل(آپاچی):
</p>
```r
apt list apache2 -a
```
یا دستور زیر
```r
apt list | grep apache2
```
<p align="right" dir="rtl">
اگر هشدار داد از دستور زیر استفاده کنید
</p>
```r
dpkg --list | grep apache2
```
<p align="right" dir="rtl">
اگر اطلاعات بیشتری می خواهید از دستور زیر بهره ببرید:
</p>
```r
apt list | more
```
و یا
```r
dpkg --list | more
```
# <p align="right" dir="rtl">نصب حداقلی بسته ها</p>
<p align="right" dir="rtl">
برای نصب حداقلی هر بسته کافیست ابتدا دستور زیر را اجرا نموده و سپس بسته را نصب کنید، به عنوان مثال نصب PHP:
</p>
```r
sudo apt-get install --dry-run php
```
<p align="right" dir="rtl">
توصیه می‌شود که قبل از نصب هر نرم‌افزاری، اجرای حداقلی را انجام دهید. زیرا اطلاعات مفیدی در اختیار شما قرار می‌دهد.
<br>
حال بسته ی مورد نظر را نصب نمائید(مثلاphp):
</p>
```r
sudo apt-get install php
```
<p align="right" dir="rtl">
اگر نسخه خاصی از نرم افزار مد نظر شماست حتما قید کنید، (مثلا php 8.2)
</p>
```r
sudo apt-get install php8.2 -y
```
# <p align="right" dir="rtl">فایروال</p>
<p align="right" dir="rtl">
اگر سرویسهای نصب شده اجرا نمی شوند و یا از خارج به آنها دسترسی ندارید، احتمال زیاد دارد که از فایروال باشد و برای آزمایش و به صورت موقت و در ساده ترین حال فایروالها را غیر فعال کنید:<br>
البته توجه داشته باشید که این کار فقط برای آزمایش است و به سرعت بایستی تنظیمات فایروال صورت گرفته و مجدد فعال شود.<br>
دستورات زیر فایروالهای ufw و iptables را غیرفعال می کند:
</p>
```r
sudo ufw disable && sudo iptables disable
```
<p align="right" dir="rtl">
در غیر اینصورت و درصورت آشنایی با فایروال می توانید پورتها و سرویسهایی که لازم است اجرا شود را به فایروال معرفی و اجازه اجرای آن را ثبت نمائید. به عنوان مثال سرویس ssh به صورت پیش فرض پورت 22 استفاده می کند. پس به صورت زیر عمل می کنیم:
</p>
```r
sudo ufw allow ssh && sudo ufw allow 22 && sudo ufw reload
```
<p align="right" dir="rtl">
یا برای اتصال از راه دور به MariaDBبایستی پورت 3306 باز باشد، برای این باید دستور زیر را اجرا کنید :
</p>
```r
sudo ufw allow 3306 && sudo ufw reload
```
<p align="right" dir="rtl">
اما اگر بخواهیم فقط ip خاصی مثلا(192.168.100.100) بتواند به سرور دسترسی داشته باید از دستور زیر استفاده می کنیم:
</p>
```r
sudo ufw allow from 192.168.100.100 to any port 3306 && sudo ufw reload
```
# <p align="right" dir="rtl">SSH</p>
<p align="right" dir="rtl"> برای اتصال از راه دور به سرور بایستی سرویس SSH فعال و اجرا شود. با دستورات زیر: </p>
```r
sudo systemctl enable ssh && sudo systemctl start ssh
```
## <p align="right" dir="rtl"> باز کردن سرویس SSH در فایروال: </p>
```r
sudo ufw allow ssh && sudo ufw reload
```
<p align="right" dir="rtl">نحوه اتصال از راه دور در محیط terminel در سیستم عامل لینوکس و یا CMD در سیستم عامل ویندوز، از دستور زیر استفاده کنید:
به جای username@ip_address -p port_number مقادیر درست قرار دهید، مثلا:
</p>
```r
ssh root@192.168.100.100 -p 22
```
## <p align="right" dir="rtl"> نحوه ی تغییر پورت SSH: </p>
```r
sudo nano /etc/ssh/sshd_config
```
<p align="right" dir="rtl">باید در این فایل به دنبال یکی از خطوط زیر باشید</p>
<p style="background-color:black;color:white;">
<code>
Port 22
#Port 22
</code>
</p>
<p align="right" dir="rtl">
ابتدا #را حذف کنید و سپس به جای عدد 22 شماره پورتی که می خواهید به آن متصل شوید را وارد نمایید. مثلا 2222 سپس با CTRL+O تغییرات را ذخیره نموده و با CTRL+X از فایل خارج شوید.</p>
<p dir="rtl" align="center">صلوات</p>

164
1-Ubuntu/more/1-firewall.md Normal file
View File

@ -0,0 +1,164 @@
<p dir="rtl" align="center">بسم الله الرحمن الرحیم</p>
<p dir="rtl" align="right">
در زیر چند نمونه از نحوه به کارگیری فایروال ufw آورده شده است:
<br>
ابتدا ufw فعال می شود. با دستور زیر از خط فرمان:
</p>
```r
sudo ufw enable
```
<p dir="rtl" align="right">
برای باز کردن یک پورت ( مثل پورت SSH) از این دستور استفاده می شود. برای بازکردن سایر پورتها، کافیست عدد آن پورت را در دستور زیر عوض کنید. مثلا پورت 9200 برای الاستیک سرچ یا 5601 برای کیبانا:
</p>
```r
sudo ufw allow 22
```
<p dir="rtl" align="right">
نکته: پورت 22 به عنوان پیش فرض برای SSH قرار داده شده ولی ممکن است در تنظیمات SSH این پورت تغییر یابد.
باز بودن پورت SSH برای ارتباط از راه دور به سرور لازم است و نیز ارتباط با دیتابیس.
<br>
<br>
قوانین همچنین می توانند با استفاده از یک قالب شماره گذاری شده اضافه شوند:
به عنوان مثال: دستور زیر قانون۱ را باز کردن پورت 80 قرار می دهد.
</p>
```r
sudo ufw insert 1 allow 80
```
<p dir="rtl" align="right">
به طور مشابه، برای بستن یک پورت باز شده از دستور زیر استفاده می شود: پورت 22 به عنوان مثال آورده شده است.
</p>
```r
sudo ufw deny 22
```
<p dir="rtl" align="right">
برای حذف یک قانون، از delete و به دنبال آن قانون استفاده کنید:
در مثال زیر قانون همان "deny 22" است
</p>
```r
sudo ufw delete deny 22
```
<p dir="rtl" align="right">
همچنین امکان دسترسی از هاست یا شبکه های خاص به یک پورت وجود دارد. مثال زیر اجازه دسترسی SSH را از میزبان 192.168.0.2 به هر آدرس IP در این میزبان می دهد:
</p>
```r
sudo ufw allow proto tcp from 192.168.0.2 to any port 22
```
<p dir="rtl" align="right">
192.168.0.2 را با 192.168.0.0/24 جایگزین کنید تا امکان دسترسی SSH از کل زیر شبکه فراهم شود.
</p>
<p dir="rtl" align="right">
افزودن گزینه dry-run به یک دستور ufw نتیجه قوانین را نمایش می دهد، اما آنها را اعمال نمی کند. به عنوان مثال، موارد زیر در صورت باز کردن پورت HTTP اعمال می شود:
</p>
```r
sudo ufw --dry-run allow http
```
<p style="background-color:black;color:white;" >
<code>
*filter
:ufw-user-input - [0:0]
:ufw-user-output - [0:0]
:ufw-user-forward - [0:0]
:ufw-user-limit - [0:0]
:ufw-user-limit-accept - [0:0]
### RULES ###
<br>
### tuple ### allow tcp 80 0.0.0.0/0 any 0.0.0.0/0
-A ufw-user-input -p tcp --dport 80 -j ACCEPT
<br>
### END RULES ###
-A ufw-user-input -j RETURN
-A ufw-user-output -j RETURN
-A ufw-user-forward -j RETURN
-A ufw-user-limit -m limit --limit 3/minute -j LOG --log-prefix "[UFW LIMIT]: "
-A ufw-user-limit -j REJECT
-A ufw-user-limit-accept -j ACCEPT
COMMIT
Rules updated
</code>
</p>
<p dir="rtl" align="right">
ufw را می توان با دستور زیر غیرفعال کرد:
</p>
```r
sudo ufw disable
```
<p dir="rtl" align="right">
ufw را برای اعمال تغییرات غیرفعال و دوباره فعال کنید:
</p>
```r
sudo ufw disable && sudo ufw enable
```
<p dir="rtl" align="right">
برای مشاهده وضعیت فایروال، دستور زیر ار اجرا کنید:
</p>
```r
sudo ufw status
```
<p dir="rtl" align="right">
و برای اطلاعات دقیق تر وضعیت از دستور زیر بهره بگیرید:
</p>
```r
sudo ufw status verbose
```
<p dir="rtl" align="right">
برای مشاهده قوانین فایروال با فرمت شماره گذاری شده دستور زیر را اجرا کنید:
</p>
```r
sudo ufw status numbered
```
<p dir="rtl" align="justify">
توجه داشته باشید
<br>
اگر پورتی که می خواهید باز یا بسته شود در /etc/services تعریف شده است، می توانید به جای شماره از نام پورت استفاده کنید. در مثال های بالا عدد 22 را با ssh جایگزین کنید.
<br>
توجه جدی داشته باشید که در صورتی که سرویسهای نصب شده قابل اجرا نبودند و شما علت را نمی دانید، در اولین مرحله ذهن شما بایستی متوجه فایروال باشد. پس قبل از هر کاری اول با دستور زیر فایروال را غیر فعال کنید و اگر مشکل حل نشد به دنبال موارد دیگر بروید.
اگر هم مشکل حل شد بدانید بایستی تنظیمات فایروال را با توجه به نیاز سرویسها به روزرسانی کنید.
<br>
و نکته دیگر اینکه ممکن است فایروالهای مختلفی روی سرور شما نصب باشد ufw فقط یکی از آنهاست.
<br>
مثلا ممکن است روی سرورشما iptables نصب شده باشد iptables یک ابزار برای فایروالینگ (فایروال لینوکس است) ؛ که بروی بیشتر توزیع‌های لینوکس به صورت پیش‌فرض نصب است. و جالبست که گاهی حتی با غیرفعال کردن آن هم باز مشکل حل نمی شود.
مثل موردی که فقط با دستور sudo iptables --flush مشکل حل شد. درحالی که iptables غیرفعال شده بود.
پس در این موارد حتما با کارشناس مربوطه مشورت نمایید.
</p>
<p dir="rtl" align="right">
ufw را می توان با دستور زیر غیرفعال کرد:
</p>
```r
sudo ufw disable
```
<p dir="rtl" align="center">صلوات</p>

210
1-Ubuntu/more/2-SSH.md Normal file
View File

@ -0,0 +1,210 @@
<p dir="rtl" align="center">بسم الله الرحمن الرحیم</p>
<div dir="rtl" align="justify">
# نحوه نصب SSH در اوبونتو سرور
SSH به طور پیش فرض بر روی سیستم های دسکتاپ اوبونتو نصب نمی شود اما می توان به راحتی آن را از مخازن استاندارد اوبونتو نصب کنید. برای اینکه بتوانید عملیات نصب و فعال سازی SSH را روی سرور لینوکس اوبونتو انجام دهید، کافیست دستورات زیر را به ترتیب رعایت کنید:
در ابتدا باید بتوانید ترمینال سیستم خود را باز کنید. برای این کار می توانید از میانبر صفحه کلید Ctrl + Alt + T استفاده کنید و یا بر روی آیکون این برنامه کلیک کنید و سپس به راحتی آن را باز کنید و سپس پکیج openssh-server را نصب کنید. برای این کار کافیست دستور زیر را وارد کنید:
<div align="left">
```r
sudo apt update
sudo apt install openssh-server
```
</div>
پس از درخواستی که به شما ارسال می شود باید رمز عبور را وارد کنید و برای ادامه پیدا کردن روند نصب حرف Y را وارد کنید.
پس از اتمام نصب، سرویس SSH به طور خودکار شروع به کار می کند. برای تایید اینکه نصب موفقیت آمیز بوده و سرویس SSH در حال اجراست، دستور زیر را که وضعیت سرور SSH را پرینت خواهد گرفت، تای و سپس اجرا کنید:
<div align="left">
```r
sudo systemctl status ssh
```
</div>
اوبونتو با یک ابزار پیکربندی firewall که با نام UFW شناخته شده است، همراه می باشد. اگر firewall بر روی سیستم شما فعال شده است، اطمینان حاص کنید که پورت SSH را باز کرده اید. برای این کار کافیست تا دستور زیر را وارد کنید:
<div align="left">
```r
sudo ufw allow ssh
```
</div>
اکنون که SSH بر روی سیستم اوبونتو نصب و راه اندازی شده است، می توانید از طریق دستگاه SSH به هر ماشین از راه دوری که می خواهید متصل شوید. دو سیستم لینوکس و macOS دارای سرویس های SSH هستند که به صورت پیش فرض نصب شده اند. اگر می خواهید به وسیله یک دستگاه ویندوز متصل شوید می توانید از یک مشتری SSH مانند PuTTY استفاده کنید.
اتصال به SSH در اوبونتو از طریق LAN
برای اینکه بتوانید به دستگاه اوبونتو از طریق LAN اتصال پیدا کنید، تنها کاری که باید انجام دهید این است که دستور زیر را وارد کنید:
<div align="left">
```r
ssh username@ip_address
```
</div>
در این دستور پورت را به طور پیشفرض 22 در نظر می گیرد، ولی اگر پورت را تغییر داده باشید بایستی با دستور زیر شماره پورت را وارد نمایید.
مثال: فرض کنید پورت را به 2222 تغییر داده ایم.
البته باید این را در نظر داشته باشید از آن جایی که پورت اتصال به دایرکت ادمین نیز 2222 است، ممکن است در برخی از فایروال ها ایجاد مشکل می کند، پس بهتر است تا پورت دیگری را انتخاب نمائید.
<div align="left">
```r
ssh username@ip_address -p 2222
```
</div>
## نحوه ی تغییر پورت SSH:
<div align="left">
```r
sudo nano /etc/ssh/sshd_config
```
</div>
باید در این فایل به دنبال یکی از خطوط زیر باشید
<p style="background-color:black;color:white;" align="left">
<code>
Port 22
#Port 22
</code>
</p>
ابتدا #را حذف کنید و سپس به جای عدد 22 شماره پورتی که می خواهید به آن متصل شوید را وارد نمایید. مثلا 2222 سپس با CTRL+O تغییرات را ذخیره نموده و با CTRL+X از فایل خارج شوید.
یوزر نیم را با نام کاربری واقعی و ip_address را با آدرس IP دستگاه اوبونتو که در آن SSH را نصب کرده اید، تغییر دهید و یا جایگزین کنید. اگر آدرس IP خود را نمی دانید و از آن اطلاعی ندارید، به راحتی می توانید با استفاده از دستور زیر، آن را پیدا کنید:
<div align="left">
```r
ip a
```
</div>
پس از یافتن آدرس ip با استفاده از اجرای دستور SSH زیر، می توانید به دستگاه از راه دور وارد شوید:
<div align="left">
```r
ssh username@192.168.121.111 -p 22
```
</div>
هنگامی که برای اولین بار از طریق SSH متصل می شوید، پیامی را مانند چیزی که در ادامه آورده خواهد شد، مشاهده می کنید:
<p style="background-color:black;color:white;" align="left">
<code>
The authenticity of host '192.168.121.111 (192.168.121.111)' can't be established.
ECDSA key fingerprint is SHA256:Vybt22mVXuNuB5unE++yowF7lgA/9/2bLSiO3qmYWBY.
Are you sure you want to continue connecting (yes/no)?
</code>
</p>
برای اتصال نهایی از شما تاییدیه خواسته می شود. به همین علت شما باید بله را تایپ کنید و بعد دوباره درخواست رمز عبور از شما خواسته خواهد شد که به ترتیب باید گذرواژه مورد نظرتان را تایپ و وارد کنید. در این صورت دستوری مانند آنچه که در ادامه آورده خواهد شد، مشاهده می کنید:
<p style="background-color:black;color:white;" align="left">
<code>
Warning: Permanently added '192.168.121.111' (ECDSA) to the list of known hosts.
linuxize@192.168.121.111's password:
</code>
</p>
پس از وارد کردن رمز عبور، پیغامی مثل مورد زیر را دریافت خواهید کرد:
<p style="background-color:black;color:white;" align="left">
<code>
Welcome to Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-33-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
...
</code>
</p>
در صورت دیدن نتیجه فوق، شما موفق شده اید که وارد دستگاه اوبونتو شوید.
اتصال به SSH از طریق اینترنت
برای اتصال به دستگاه اوبونتو با استفاده از اینترنت، در ابتدا باید آدرس IP عمومی خود را بشناسید و سپس روتر خود را پیکربندی کنید. این کار برای این است تا دستگاه بتواند داده های پورت 22 را قبول کند و سپس آن را به دستگاه اوبونتویی که SSH در آن جا کار می کند، ارسال کند.
برای اینکه بتوانید آدرس عمومی IP خود را پیدا کنید، کافیست تا به آدرس زیر مراجعه کنید:
<div align="left">
```r
https://ifconfig.co/ip
```
</div>
هنگامی که می خواهید قسمت ارسال پورت را تنظیم کنید باید بدانید که هر روتر روش خاصی را برای ارسال پورت دارد. برای این کار شما باید اسناد روتر سیستم را در مورد نحوه ارسال و تنظیم پورت مورد بررسی قرار دهید و شما باید شماره پورت درخواستی تان را ارسال کنید (پورت پیش فرض SSH، 22 است) و سپس آدرس IP خصوصی که را زودتر آن را پیدا کرده اید را وارد می کنید. تمام این کارها در SSH انجام می گیرد.
هنگامی که آدرس IP را پیدا و روتر خود را پیکربندی کردید، می توانید با تایپ کردن دستور زیر وارد سیستم شوید:
<div align="left">
```r
ssh username@public_ip_address -p 22
```
</div>
اگر دستگاه خود را به اینترنت متصل می کنید، ایده بسیار خوبی به شما می رود. زیرا با استفاده از اینترنت می توان برخی از اقدامات امنیتی را به راحتی انجام داد. یکی از اساسی ترین کارهایی که باید انجام دهید این است که روتر خود را به منظور پذیرش ترافیک موجود در SSH بر روی پورت غیر استاندارد پیکربندی کنید و آن را به پورتی با نام 22 ارسال کنید. این پورت باید در دستگاهی باشد که سرویس SSH را اجرا می کند.
همچنین شما می توانید احراز هویت مبتنی بر کلید SSH را تنظیم کنید و بدون اینکه بخواهید رمز عبوری را وارد کنید، به دستگاه اوبونتو متصل شوید.
غیر فعال کردن SSH در اوبونتو
اگر به خاطر دلایل مختلفی می خواهید تا SSH را در دستگاه اوبونتو غیر فعال کنید، به راحتی می توانید با وارد کردن دستگاه زیر مانع از اجرا آن شوید:
<div align="left">
```r
sudo systemctl stop ssh
```
</div>
برای اجرا دوباره آن می توانید از دستور زیر بهره ببرید:
<div align="left">
```r
sudo systemctl start ssh
```
</div>
برای غیر فعال کردن سرویس SSH به منظور شروع آن در هنگام سیستم بوت، نیاز است تا دستور زیر را اجرا کنید:
<div align="left">
```r
sudo systemctl disable ssh
```
</div>
همچنین برای فعال کردن دوباره آن، دستور زیر را اجرا کنید:
<div align="left">
```r
sudo systemctl enable ssh
```
</div>
نصب و استفاده از ssh در اوبونتو می تواند به شما این امکان را بدهد تا امنیت بسیار بیشتری را در هنگام ارسال فایل ها و اطلاعات مختف تجربه کنید.
</div>
<p dir="rtl" align="center">صلوات</p>

74
1-Ubuntu/more/3-task.md Normal file
View File

@ -0,0 +1,74 @@
<p dir="rtl" align="center">بسم الله الرحمن الرحیم</p>
<div dir="rtl" align="justify">
روش استاندارد یونیکس/لینوکس/اوبونتو برای زمان‌بندی استفاده از cron است. همچنین می‌توان از systemctl استفاده کرد که بسیار انعطاف‌پذیرتر، اما بسیار پیچیده‌تر است.
سرویس cron بخشی از نصب استاندارد است، بنابراین احتمالاً قبلاً آن را دارید. در صورت عدم انجام، به روش معمول نصب کنید:
<div dir="ltr" align="left">
```r
sudo apt install cron
```
</div>
برای زمان‌بندی کارتان، دستور crontab یک زمان‌بندی را در ویرایشگر پیش‌فرض شما باز می‌کند:
<div dir="ltr" align="left">
```r
crontab -e
```
</div>
اگر قبلا ویرایشگر انتخاب نکرده اید، از شما خواسته می شود یکی را انتخاب کنید. ساده ترین کار برای این کار nano خواهد بود. سپس فایلی را به شکل زیر ویرایش خواهید کرد:
<p style="background-color:black;color:white;" dir="ltr" align="left">
<code>
# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').
#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h dom mon dow command
</code>
</p>
به مثال فایل بالا توجه کنید. برای اجرای اسکریپت پایتون هر روز در ساعت 3 صبح، از ورودی مانند زیر استفاده کنید:
<div dir="ltr" align="left">
```r
0 3 * * * python /path/to/my/script
```
</div>
وقتی از ویرایشگر خارج می‌شوید، کار cron تنظیم می‌شود تا در دفعه بعد که با معیارها مطابقت دارد اجرا شود. من متوجه هستم که این راه حل بسیار خط فرمان است، اما اشکالی ندارد، زیرا شما این کار را اغلب انجام نمی دهید. بسیاری از کارهای فانتزی دیگر وجود دارد که می توانید با کرون انجام دهید، مانند اجرای کارها در فواصل زمانی خاص در طول روز. برای چند مثال مفید، نگاهی به این موارد بیندازید:
<div dir="ltr" align="left">
```r
man 5 crontab
```
</div>
</div>
<p dir="rtl" align="center">صلوات</p>

View File

@ -0,0 +1,49 @@
<div dir="rtl" align="right">
بسم الله الرحمن الرحیم
پیش نیازهای تغییر آی پی در سرور مجازی لینوکس
قبل از تغییر آدرس IP خود، حتماً آدرس IP فعلی را خودتان چک کنید. برای این کار، نیاز به دستورات پیچیده ای ندارید، می توانید از دستور زیر برای این کار استفاده کنید:
```r
ip a
```
تغییر IP در لینوکس با استفاده از ifconfig
هرچند که دستور ifconfig منسوخ شده است و ما توصیه می کنیم که از دستور ip استفاده کنید، اما از دستور ifconfig برای تغییر دادن آدرس IP می توانید استفاده کنید:
```r
which ifconfig
/usr/sbin/ifconfig
```
برای آن که آدرس IP را در سرور مجازی لینوکس تغییر دهید، می توانید دستور ifconfig را به همراه نام رابط شبکه و آدرس آی پی جدیدی که می خواهید روی سیستم خودتان تغییر دهید، وارد کنید.
برای اختصاص دادن ماسک زیرشبکه، می‌توانید یا یک بند netmask به همراه ماسک زیرشبکه اضافه کنید یا مستقیماً از نماد CIDR استفاده کنید.
```r
ifconfig <interface_name> <ip_address> netmask <netmask_address>
```
توجه: برای تغییر آدرس آی پی شما باید در سیستم خودتان administrator باشید.
به عنوان مثال، با توجه به آدرس‌های IP استفاده شده در بخش‌های قبلی، اگر می‌خواهیم آدرس IP خود را به 192.168.178.32/24 تغییر دهیم، باید دستور زیر را اجرا کنیم.
```r
ifconfig enp0s3 192.168.178.32/24
ifconfig enp0s3 192.168.178.32 netmask 255.255.255.0
```
برای اطمینان از اینکه آدرس IP شما به درستی تغییر کرده است، می توانید دستور ifconfigرا دنبال شده توسط نام آداپتور شبکه خود اجرا کنید.
```r
ifconfig <interface_name>
```
[منبع](https://asamserver.com/blog/change-ip-on-ubuntu-debian-centos/)
</div>

View File

@ -0,0 +1,10 @@
<p style="color:white;background-color:black;">
<code>
{
line 1 of code
line 2 of code();
line 3 of code
}
</code>
</p>

View File

@ -0,0 +1,152 @@
# مختصر:
## SCP کپی امن (برنامه کپی فایل از راه دور)
This tutorial will demonstrate how to use the scp command through practical examples and detailed explanations of the most commonly used scp options.
## SCP Command Syntax
Before going into how to use the scp command, lets start by reviewing the basic syntax.
The scp command syntax takes the following form:
```linux
scp [OPTION] [user@]SRC_HOST:]file1 [user@]DEST_HOST:]file2
```
مثال:
```
scp -r -P 22 admin@192.168.1.1:/home/dir1 /home/
```
OPTION - scp options such as cipher, ssh configuration, ssh port, limit, recursive copy …etc.
* [user@]SRC_HOST:]file1 - Path to the source file. The name of the user on the source machine and the hostname (or the IP address) of the source machine are used when the file is located on a remote machine.
* [user@]DEST_HOST:]:file2 - Path to the destination file. The name of the user on the destination machine and the hostname (or the IP address) of the destination machine are used when the file is located on a remote machine.
# توضیحات مفصل:
## SCP کپی امن (برنامه کپی فایل از راه دور)
Name
scp - secure copy (remote file copy program)
## خلاصه:
```
scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file] [-l limit] [-o ssh_option] [-P port] [-S program] [
[user@]host1:]file1 ... [ [user@]host2:]file2
```
## Description
scp فایل ها را بین میزبان ها در یک شبکه کپی می کند. از ssh(1) برای انتقال داده استفاده می کند و از همان احراز هویت استفاده می کند و همان امنیت ssh (1) را فراهم می کند. برخلاف rcp(1)، scp در صورتی که برای احراز هویت مورد نیاز باشد، رمز عبور یا عبارت عبور را درخواست می کند.
نام فایل ممکن است حاوی مشخصات کاربر و میزبان باشد تا نشان دهد که فایل باید در/از آن میزبان کپی شود. نام فایل‌های محلی را می‌توان با استفاده از نام‌های مسیر مطلق یا نسبی صریح کرد تا از استفاده scp با نام فایل‌های حاوی «:» به‌عنوان مشخص‌کننده میزبان جلوگیری شود. کپی بین دو میزبان راه دور نیز مجاز است.
هنگام کپی کردن یک فایل منبع به یک فایل هدف که از قبل وجود دارد، scp محتویات فایل هدف را جایگزین می کند (با حفظ inode).
اگر فایل مورد نظر هنوز وجود نداشته باشد، یک فایل خالی با نام فایل هدف ایجاد می شود و سپس با محتوای فایل منبع پر می شود. هیچ تلاشی برای انتقال "نزدیک به اتمی" با استفاده از فایل های موقت انجام نمی شود.
گزینه ها به شرح زیر است:
<code>
-1' Forces scp to use protocol 1.
-2' Forces scp to use protocol 2.
-4' Forces scp to use IPv4 addresses only.
-6' Forces scp to use IPv6 addresses only.
-B' Selects batch mode (prevents asking for passwords or passphrases).
-C' Compression enable. Passes the -C flag to ssh(1) to enable compression.
-c cipher
Selects the cipher to use for encrypting the data transfer. This option is directly passed to ssh(1).
-F ssh_config
Specifies an alternative per-user configuration file for ssh. This option is directly passed to ssh(1).
-i identity_file
Selects the file from which the identity (private key) for public key authentication is read. This option is directly passed to ssh(1).
-l limit
Limits the used bandwidth, specified in Kbit/s.
-o ssh_option
Can be used to pass options to ssh in the format used in ssh_config(5). This is useful for specifying options for which there is no separate scp command-line flag. For full details of the options listed below, and their possible values, see ssh_config(5).
AddressFamily
BatchMode
BindAddress
ChallengeResponseAuthentication
CheckHostIP
Cipher
Ciphers
Compression
CompressionLevel
ConnectionAttempts
ConnectTimeout
ControlMaster
ControlPath
GlobalKnownHostsFile
GSSAPIAuthentication
GSSAPIDelegateCredentials
HashKnownHosts
Host'
HostbasedAuthentication
HostKeyAlgorithms
HostKeyAlias
HostName
IdentityFile
IdentitiesOnly
KbdInteractiveDevices
LogLevel
MACs'
NoHostAuthenticationForLocalhost
NumberOfPasswordPrompts
PasswordAuthentication
Port'
PreferredAuthentications
Protocol
ProxyCommand
PubkeyAuthentication
RekeyLimit
RhostsRSAAuthentication
RSAAuthentication
SendEnv
ServerAliveInterval
ServerAliveCountMax
SmartcardDevice
StrictHostKeyChecking
TCPKeepAlive
UsePrivilegedPort
User'
UserKnownHostsFile
VerifyHostKeyDNS
-P port
پورتی را برای اتصال در میزبان راه دور مشخص می کند. توجه داشته باشید که این گزینه با P بزرگ نوشته شده است، زیرا -p از قبل برای حفظ زمان ها و حالت های فایل در rcp(1) رزرو شده است.
-p' Preserves modification times, access times, and modes from the original file.
-q' Quiet mode: disables the progress meter as well as warning and diagnostic messages from ssh(1).
-r' Recursively copy entire directories. Note that scp follows symbolic links encountered in the tree traversal.
-S program
Name of program to use for the encrypted connection. The program must understand ssh(1) options.
-v' Verbose mode. Causes scp and ssh(1) to print debugging messages about their progress. This is helpful in debugging connection, authentication, and configuration problems.
The scp utility exits 0 on success, and >0 if an error occurs.
IPV6
</code>
IPv6 address can be used everywhere where IPv4 address. In all entries must be the IPv6 address enclosed in square brackets. Note: The square brackets are metacharacters for the shell and must be escaped in shell.

View File

@ -0,0 +1,100 @@
<div align="justify" dir="rtl">
<p align="center" dir="rtl">بسم الله الرحمن الرحیم</p>
### استفاده از setfacl برای تنظیم دسترسی خاصِ کاربر خاص و پوشه و فایل خاص:
### نصب acl در اوبونتو:
<div align="left" dir="ltr">
```r
apt-get install acl
```
</div>
### دستور زیر تمامی دسترسی ها را لیست می کند:
<div align="left" dir="ltr">
```
ls -lR
```
### توضیح:
| Option | Description |
| ----- | ---------------------------------------------------- |
| ls: | این دستور تمام محتویات دایرکتوری فعلی را فهرست می کند. |
| -lR: | این گزینه تمام محتویات دایرکتوری و زیر شاخه فعلی را با اندازه، اطلاعات مجوز، اطلاعات مالک، اطلاعات گروه، زمان آخرین تغییر و غیره لیست می کند.|
</div>
کاربر faru5903 هیچ دسترسی به پوشه و زیر شاخه های /home/folder ندارد
<div align="center" dir="ltr">
| Option | Description |
| ------ | ----------- |
| (r) | Read |
| (w) | Write |
| (x) | Execute |
</div>
<div align="left" dir="ltr">
```
sudo setfacl -R -m u:faru5903:--- /home/folder
```
</div>
کاربر faru5903 همه دسترسی ها(خواندن و نوشتن و اجرا) به پوشه و زیر شاخه های /home/folder دارد
<div align="left" dir="ltr">
```
sudo setfacl -R -m u:faru5903:rwx /home/folder
```
</div>
کاربر faru5903 دسترسی فقط خواندن به پوشه و زیر شاخه های /home/folder دارد
<div align="left" dir="ltr">
```
sudo setfacl -R -m u:faru5903:r /home/folder
```
</div>
کاربر faru5903 دسترسی فقط اجرا به پوشه و زیر شاخه های /home/folder دارد
<div align="left" dir="ltr">
```
sudo setfacl -R -m u:faru5903:x /home/folder
```
</div>
کاربر faru5903 دسترسی فقط نوشتن به پوشه و زیر شاخه های /home/folder دارد
<div align="left" dir="ltr">
```
sudo setfacl -R -m u:faru5903:w /home/folder
```
</div>
<p align="center" dir="rtl">صلوات</p>
</div>

View File

@ -0,0 +1,131 @@
<p dir="rtl" align="center">بسم الله الرحمن الرحیم</p>
<p dir="rtl" align="right">
فهرست مطالب
</p>
<p dir="rtl" align="right">
[گام 1 - به روز رسانی سیستم](ام1)
</p>
<p dir="rtl" align="right">
[گام 2 - نصب Apache](ام2)|
</p>
<p dir="rtl" align="right">
[گام 3 - بررسی وضعیت Apache ](ام3)|
</p>
<p dir="rtl" align="right">
[گام 4 - تنظیمات هاست مجازی](ام4)|
</p>
<span id=ام3" dir="rtl" align="right">گام 1 - به روز رسانی سیستم</span>
```r
sudo apt update
```
به روز رسانی سیستم
<span id=ام3">گام 2 - نصب Apache</span>
```r
sudo apt install apache2
```
نصب Apache در Ubuntu
<span id=ام3" dir="rtl" align="right">گام 3 - بررسی وضعیت Apache </span>
```r
sudo systemctl status apache2
```
<p dir="rtl" align="justify">
وضعیت آپاچی را بررسی کنید<br>
آدرس IP خود را در مرورگر باز کنید تا بررسی کنید آیا سرور آپاچی در حال بارگیری است یا خیر؟
<br>
<br>
<br>
<span id=ام4">گام 4 - تنظیمات هاست مجازی</span><br>
پوشه مربوط به دامنه خود را روی سرور ایجاد کنید<br>
</p>
```r
sudo mkdir /var/www/domain-name
```
<p dir="rtl" align="justify"> به پوشه دامنه خود مجوز بدهید</p>
```r
sudo chmod -R 755 /var/www/domain-name
```
<p dir="rtl" align="justify"> ایجاد فایل نمونه index.html:</p>
```r
touch /var/www/domain-name/index.html
echo "Your domain is now online" > /var/www/domain-name/index.html
```
<p dir="rtl" align="justify"> ایجاد فایل host مجازی :</p>
```r
sudo nano /etc/apache2/sites-available/domain-name.conf
```
<p dir="rtl" align="right"> متن زیر را به فایل پیکربندی هاست (domain-name.conf) اضافه کنید :</p>
```r
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName domain-name
ServerAlias www.domain-name
DocumentRoot /var/www/domain-name
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
```
<p dir="rtl" align="justify"> برای فعال کردن فایل از a2ensite استفاده کنید:</p>
```r
sudo a2ensite domain-name.conf
or
sudo a2ensite /etc/apache2/sites-available/domain-name.conf
```
<p dir="rtl" align="justify"> در مرحله بعد باید فایل default را غیرفعال کنیم:</p>
```r
sudo a2dissite 000-default.conf
```
<p dir="rtl" align="justify"> خطاها را بررسی کنید: </p>
```r
sudo apache2ctl configtest
```
<p style="background-color:black;color:white;" >
<code>
The output should be Syntax OK
<br>
Restart Apache and navigate to your domain on the browser
</code>
</p>
```r
sudo systemctl restart apache2
```
<br>
[منبع](https://www.virtono.com/community/tutorial-how-to/how-to-install-apache-on-ubuntu-20-04%EF%BF%BC/)
<p dir="rtl" align="center">صلوات</p>

View File

@ -0,0 +1,23 @@
<p dir="rtl" align="center">بسم الله الرحمن الرحیم</p>
# <p dir="rtl" align="center">عنوان</p> #
## <p dir="rtl" align="right">گام اول: اینکه</p> ##
<p dir="rtl" align="right"></p>
<p style="background-color:black;color:white;" >
<code>
server{
dir=""
}
</code>
</p>
```r
sudo apt-get install <package>
```
<p dir="rtl" align="center">صلوات</p>

View File

@ -0,0 +1,27 @@
## Apache error.log: ##
AH00489: Apache/2.4.12 (Unix) configured -- resuming normal operations
AH00094: Command line: '/usr/local/apache2/bin/httpd'
## solution: ##
## REINSTALL APACHE2: ##
To replace configuration files that have been deleted, without purging the package, you can do:
<code>sudo apt-get -o DPkg::Options::="--force-confmiss" --reinstall install apache2</code>
* To fully remove the apache2 config files, you should:
<code>sudo apt-get purge apache2</code>
* which will then let you reinstall it in the usual way with:
<code>sudo apt-get install apache2</code>
Purge is required to remove all the config files - if you delete the config files but only remove the package, then this is remembered & missing config files are not reinstalled by default.
# Then REINSTALL PHP5: #
<code>apt-get purge libapache2-mod-php5 php5 && \</code>
<code>apt-get install libapache2-mod-php5 php5</code>

View File

@ -0,0 +1,294 @@
<p dir="rtl" align="center">
بسم الله الرحمن الرحیم
<br></p>
# <p dir="rtl" align="right"> 1-نصب Apache2 </p> #
How to install Apache2
The Apache HTTP Server (“httpd”) is the most commonly used web server on Linux systems, and is often used as part of the LAMP configuration. In this guide, we will show you how to install and configure Apache2, which is the current release of “httpd”.
Install apache2
To install Apache2, enter the following command at the terminal prompt:
```r
sudo apt install apache2
```
Configure apache2
Apache2 is configured by placing directives in plain text configuration files in /etc/apache2/. These directives are separated between the following files and directories:
Files
apache2.conf
The main Apache2 configuration file. Contains settings that are global to Apache2.
Note: Historically, the main Apache2 configuration file was httpd.conf, named after the “httpd” daemon. In other distributions (or older versions of Ubuntu), the file might be present. In modern releases of Ubuntu, all configuration options have been moved to apache2.conf and the below referenced directories and httpd.conf no longer exists.
envvars
File where Apache2 environment variables are set.
magic
Instructions for determining MIME type based on the first few bytes of a file.
ports.conf
Houses the directives that determine which TCP ports Apache2 is listening on.
In addition, other configuration files may be added using the Include directive, and wildcards can be used to include many configuration files. Any directive may be placed in any of these configuration files. Changes to the main configuration files are only recognized by Apache2 when it is started or restarted.
The server also reads a file containing MIME document types; the filename is set by the TypesConfig directive, typically via /etc/apache2/mods-available/mime.conf, which might also include additions and overrides, and is /etc/mime.types by default.
Directories
conf-available
This directory contains available configuration files. All files that were previously in /etc/apache2/conf.d should be moved to /etc/apache2/conf-available.
conf-enabled
Holds symlinks to the files in /etc/apache2/conf-available. When a configuration file is symlinked, it will be enabled the next time Apache2 is restarted.
mods-available
This directory contains configuration files to both load modules and configure them. Not all modules will have specific configuration files, however.
mods-enabled
Holds symlinks to the files in /etc/apache2/mods-available. When a module configuration file is symlinked it will be enabled the next time Apache2 is restarted.
sites-available
This directory has configuration files for Apache2 Virtual Hosts. Virtual Hosts allow Apache2 to be configured for multiple sites that have separate configurations.
sites-enabled
Like mods-enabled, sites-enabled contains symlinks to the /etc/apache2/sites-available directory. Similarly, when a configuration file in sites-available is symlinked, the site configured by it will be active once Apache2 is restarted.
# <p dir="rtl" align="right"> ۲-پیکربندی Apache2 </p> #
How to configure Apache2 settings
After you have installed Apache2, you will likely need to configure it. In this explanatory guide, we will explain the Apache2 server essential configuration parameters.
Basic directives
Apache2 ships with a “virtual-host-friendly” default configuration it is configured with a single default virtual host (using the VirtualHost directive) which can be modified or used as-is if you have a single site, or used as a template for additional virtual hosts if you have multiple sites.
If left alone, the default virtual host will serve as your default site, or the site users will see if the URL they enter does not match the ServerName directive of any of your custom sites. To modify the default virtual host, edit the file /etc/apache2/sites-available/000-default.conf.
Note:
The directives set for a virtual host only apply to that particular virtual host. If a directive is set server-wide and not defined in the virtual host settings, the default setting is used. For example, you can define a Webmaster email address and not define individual email addresses for each virtual host.
If you want to configure a new virtual host or site, copy the 000-default.conf file into the same directory with a name you choose. For example:
```r
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/mynewsite.conf
```
Edit the new file to configure the new site using some of the directives described below:
The ServerAdmin directive
Found in /etc/apache2/sites-available
Specifies the email address to be advertised for the servers administrator. The default value is webmaster@localhost. This should be changed to an email address that is delivered to you (if you are the servers administrator). If your website has a problem, Apache2 will display an error message containing this email address to report the problem to.
The Listen directive
Found in /etc/apache2/ports.conf
Specifies the port, and optionally the IP address, Apache2 should listen on. If the IP address is not specified, Apache2 will listen on all IP addresses assigned to the machine it runs on. The default value for the Listen directive is 80. Change this to:
127.0.0.1:80 to make Apache2 listen only on your loopback interface so that it will not be available to the Internet,
to e.g. 81 to change the port that it listens on,
or leave it as is for normal operation.
The ServerName directive (optional)
Specifies what FQDN your site should answer to. The default virtual host has no ServerName directive specified, so it will respond to all requests that do not match a ServerName directive in another virtual host. If you have just acquired the domain name mynewsite.com and wish to host it on your Ubuntu server, the value of the ServerName directive in your virtual host configuration file should be mynewsite.com.
Add this directive to the new virtual host file you created earlier (/etc/apache2/sites-available/mynewsite.conf).
The ServerAlias directive
You may also want your site to respond to www.mynewsite.com, since many users will assume the www prefix is appropriate use the ServerAlias directive for this. You may also use wildcards in the ServerAlias directive.
For example, the following configuration will cause your site to respond to any domain request ending in .mynewsite.com.
ServerAlias *.mynewsite.com
The DocumentRoot directive
Specifies where Apache2 should look for the files that make up the site. The default value is /var/www/html, as specified in /etc/apache2/sites-available/000-default.conf. If desired, change this value in your sites virtual host file, and remember to create that directory if necessary!
Enable the new VirtualHost using the a2ensite utility and restart Apache2:
```r
sudo a2ensite mynewsite
sudo systemctl restart apache2.service
```
Note:
Be sure to replace mynewsite with a more descriptive name for the VirtualHost. One method is to name the file after the ServerName directive of the VirtualHost.
Similarly, use the a2dissite utility to disable sites. This is can be useful when troubleshooting configuration problems with multiple virtual hosts:
```r
sudo a2dissite mynewsite
sudo systemctl restart apache2.service
```
Apache2 server default settings
This section explains configuration of the Apache2 server default settings. For example, if you add a virtual host, the settings you configure for the virtual host take precedence for that virtual host. For a directive not defined within the virtual host settings, the default value is used.
The DirectoryIndex
The DirectoryIndex is the default page served by the server when a user requests an index of a directory by specifying a forward slash (/) at the end of the directory name.
For example, when a user requests the page http://www.example.com/this_directory/, they will get either the DirectoryIndex page (if it exists), a server-generated directory list (if it does not and the Indexes option is specified), or a Permission Denied page if neither is true.
The server will try to find one of the files listed in the DirectoryIndex directive and will return the first one it finds. If it does not find any of these files and if Options Indexes is set for that directory, the server will generate and return a list, in HTML format, of the subdirectories and files in the directory. The default value, found in /etc/apache2/mods-available/dir.conf is “index.html index.cgi index.pl index.php index.xhtml index.htm”. Thus, if Apache2 finds a file in a requested directory matching any of these names, the first will be displayed.
The ErrorDocument
The ErrorDocument directive allows you to specify a file for Apache2 to use for specific error events. For example, if a user requests a resource that does not exist, a 404 error will occur.
By default, Apache2 will return a HTTP 404 Return code. Read /etc/apache2/conf-available/localized-error-pages.conf for detailed instructions on using ErrorDocument, including locations of example files.
CustomLog and ErrorLog
By default, the server writes the transfer log to the file /var/log/apache2/access.log. You can change this on a per-site basis in your virtual host configuration files with the CustomLog directive, or omit it to accept the default, specified in /etc/apache2/conf-available/other-vhosts-access-log.conf.
You can also specify the file to which errors are logged, via the ErrorLog directive, whose default is /var/log/apache2/error.log. These are kept separate from the transfer logs to aid in troubleshooting problems with your Apache2 server. You may also specify the LogLevel (the default value is “warn”) and the LogFormat (see /etc/apache2/apache2.conf for the default value).
The Options directive
Some options are specified on a per-directory basis rather than per-server. Options is one of these directives. A Directory stanza is enclosed in XML-like tags, like so:
<Directory /var/www/html/mynewsite>
...
</Directory>
The Options directive within a Directory stanza accepts one or more of the following values (among others), separated by spaces:
ExecCGI
Allow CGI scripts to be run. CGI scripts are not run if this option is not chosen.
Caution
Most files should not be run as CGI scripts. This would be very dangerous. CGI scripts should kept in a directory separate from and outside your DocumentRoot, and only this directory should have the ExecCGI option set. This is the default, and the default location for CGI scripts is /usr/lib/cgi-bin.
Includes
Allow server-side includes. Server-side includes allow an HTML file to include other files. See Apache SSI documentation (Ubuntu community) for more information.
IncludesNOEXEC
Allow server-side includes, but disable the #exec and #include commands in CGI scripts.
Indexes
Display a formatted list of the directorys contents, if no DirectoryIndex (such as index.html) exists in the requested directory.
Caution
For security reasons, this should usually not be set, and certainly should not be set on your DocumentRoot directory. Enable this option carefully on a per-directory basis only if you are certain you want users to see the entire contents of the directory.
Multiview
Support content-negotiated multiviews; this option is disabled by default for security reasons. See the Apache2 documentation on this option.
SymLinksIfOwnerMatch
Only follow symbolic links if the target file or directory has the same owner as the link.
Apache2 daemon settings
This section briefly explains some basic Apache2 daemon configuration settings.
LockFile
The LockFile directive sets the path to the lockfile used when the server is compiled with either USE_FCNTL_SERIALIZED_ACCEPT or USE_FLOCK_SERIALIZED_ACCEPT. It must be stored on the local disk. It should be left to the default value unless the logs directory is located on an NFS share. If this is the case, the default value should be changed to a location on the local disk and to a directory that is readable only by root.
PidFile
The PidFile directive sets the file in which the server records its process ID (pid). This file should only be readable by root. In most cases, it should be left to the default value.
User
The User directive sets the userid used by the server to answer requests. This setting determines the servers access. Any files inaccessible to this user will also be inaccessible to your websites visitors. The default value for User is “www-data”.
Warning
Unless you know exactly what you are doing, do not set the User directive to root. Using root as the User will create large security holes for your Web server.
Group
The Group directive is similar to the User directive. Group sets the group under which the server will answer requests. The default group is also “www-data”.
Extending Apache2
Now that you know how to configure Apache2, you may also want to know how to extend Apache2 with modules.
# <p dir="rtl" align="right"> ۳-بسته های Apache2 </p> #
How to use Apache2 modules
Apache2 is a modular server. This implies that only the most basic functionality is included in the core server. Extended features are available through modules which can be loaded into Apache2.
By default, a base set of modules is included in the server at compile-time. If the server is compiled to use dynamically loaded modules, then modules can be compiled separately, and added at any time using the LoadModule directive. Otherwise, Apache2 must be recompiled to add or remove modules.
Ubuntu compiles Apache2 to allow the dynamic loading of modules. Configuration directives may be conditionally included on the presence of a particular module by enclosing them in an <IfModule> block.
Installing and handling modules
You can install additional Apache2 modules and use them with your web server. For example, run the following command at a terminal prompt to install the Python 3 WSGI module:
```r
sudo apt install libapache2-mod-wsgi-py3
```
The installation will enable the module automatically, but we can disable it with a2dismod:
```r
sudo a2dismod wsgi
sudo systemctl restart apache2.service
```
And then use the a2enmod utility to re-enable it:
```r
sudo a2enmod wsgi
sudo systemctl restart apache2.service
```
See the /etc/apache2/mods-available directory for additional modules already available on your system.
Configure Apache2 for HTTPS
The mod_ssl module adds an important feature to the Apache2 server - the ability to encrypt communications. Thus, when your browser is communicating using SSL, the https:// prefix is used at the beginning of the Uniform Resource Locator (URL) in the browser navigation bar.
The mod_ssl module is available in the apache2-common package. Run the following command at a terminal prompt to enable the mod_ssl module:
```r
sudo a2enmod ssl
```
There is a default HTTPS configuration file in /etc/apache2/sites-available/default-ssl.conf. In order for Apache2 to provide HTTPS, a certificate and key file are also needed. The default HTTPS configuration will use a certificate and key generated by the ssl-cert package. They are good for testing, but the auto-generated certificate and key should be replaced by a certificate specific to the site or server.
Note:
For more information on generating a key and obtaining a certificate see Certificates.
To configure Apache2 for HTTPS, enter the following:
```r
sudo a2ensite default-ssl
```
Note:
The directories /etc/ssl/certs and /etc/ssl/private are the default locations. If you install the certificate and key in another directory make sure to change SSLCertificateFile and SSLCertificateKeyFile appropriately.
With Apache2 now configured for HTTPS, restart the service to enable the new settings:
```r
sudo systemctl restart apache2.service
```
Note that depending on how you obtained your certificate, you may need to enter a passphrase when Apache2 restarts.
You can access the secure server pages by typing https://your_hostname/url/ in your browser address bar.
Sharing write permission
For more than one user to be able to write to the same directory you will need to grant write permission to a group they share in common. The following example grants shared write permission to /var/www/html to the group “webmasters”.
```r
sudo chgrp -R webmasters /var/www/html
sudo chmod -R g=rwX /var/www/html/
```
These commands recursively set the group permission on all files and directories in /var/www/html to allow reading, writing and searching of directories. Many admins find this useful for allowing multiple users to edit files in a directory tree.
Warning:
The apache2 daemon will run as the www-data user, which has a corresponding www-data group. These should not be granted write access to the document root, as this would mean that vulnerabilities in Apache or the applications it is serving would allow attackers to overwrite the served content.
منابع:<br>
[نصب](https://ubuntu.com/server/docs/how-to-install-apache2)<br>
[پیکربندی](https://ubuntu.com/server/docs/how-to-configure-apache2-settings)<br>
[بسته ها](https://ubuntu.com/server/docs/how-to-use-apache2-modules)<br>
صلوات

View File

@ -0,0 +1,50 @@
# install apache on ubunto 20.04 #
---
## ● Step 1 — Installing Apache ##
### 1: <code>*$ sudo apt update*</code> ##
### 2: <code>*$ sudo apt install apache2*</code> ##
## ● Step 2 — Adjusting the Firewall ##
<p><red> List the ufw application profiles by typing: </red></p>
### <code>*$ sudo ufw app list*</code> ###
#### Output: ####
> + Available applications:<br>
+ Apache<br>
+ Apache Full<br>
+ Apache Secure<br>
+ OpenSSH<br>
### <code>*$ sudo ufw allow 'Apache'*</code> ##
## ● Step 3 — Checking your Web Server ##
### <code>*$ sudo systemctl status apache2*</code> ###
#### Output: ####
> apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2020-04-23 22:36:30 UTC; 20h ago
Docs: https://httpd.apache.org/docs/2.4/
Main PID: 29435 (apache2)
Tasks: 55 (limit: 1137)
Memory: 8.0M
CGroup: /system.slice/apache2.service
├─29435 /usr/sbin/apache2 -k start
├─29437 /usr/sbin/apache2 -k start
└─29438 /usr/sbin/apache2 -k start
## Try typing this at your command prompt(server): ##
### <code>*$ hostname -I*</code> ###
Another option is to use the Icanhazip tool, <br>
which should give you your public IP address as read <br>
from another location on the internet:
### <code>*$ curl -4 icanhazip.com*</code> ###
When you have your IP address(server), enter it into your address bar(browser):
http://your_server_ip
---
# uninstall apache on ubunto 20.04 #

View File

@ -0,0 +1,80 @@
What is Apache HTTP?
The Apache HTTP Server is a free and open-source cross-platform web server software, released under the terms of Apache License 2.0. Apache is developed and maintained by an open community of developers under the auspices of the Apache Software Foundation.
Table of Contents
Step 1 Updating the system
Step 2 Install Apache
Step 3 Check Apache status
Step 4 Set up Virtual Hosts
## Step 1 Updating the system##
<code>sudo apt update</code>
Updating Ubuntu system
## Step 2 Install Apache##
<code>sudo apt install apache2</code>
Install Apache Ubuntu
## Step 3 Check Apache status##
<code>sudo systemctl status apache2</code>
Check Apache status
Open your IP address on the browser to check if the Apache server is loading
Apache2 Ubuntu
## Step 4 Set up Virtual Hosts##
Create your domain directory on the server
<code>sudo mkdir /var/www/domain-name</code>
Give permissions to your domain directory
<code>sudo chmod -R 755 /var/www/domain-name</code>
Create a sample index.html
<code>touch /var/www/domain-name/index.html</code>
<code>echo "Your domain is now online" > /var/www/domain-name/index.html</code>
Create a virtual host file
<code>sudo nano /etc/apache2/sites-available/domain-name.conf</code>
Add the following content to your domain-name.conf file
> <VirtualHost *:80> <br>
- ServerAdmin webmaster@localhost <br>
- ServerName domain-name <br>
- ServerAlias www.domain-name <br>
- DocumentRoot /var/www/domain-name <br>
- ErrorLog ${APACHE_LOG_DIR}/error.log <br>
- CustomLog ${APACHE_LOG_DIR}/access.log combined <br>
<\/VirtualHost> <br>
Use a2ensite to enable the file
sudo a2ensite domain-name.conf
or
sudo a2ensite /etc/apache2/sites-available/domain-name.conf
Next, we have to disable the default file
<code>sudo a2dissite 000-default.conf</code>
Check for errors
<code>sudo apache2ctl configtest</code>
The output should be Syntax OK
Restart Apache and navigate to your domain on the browser
<code>sudo systemctl restart apache2<code>/
End

View File

@ -0,0 +1,27 @@
How to remove Apache2 from Ubuntu Server
August 29, 2022 Santosh Ubuntu Server No Comments
A very simple and straightforward way that worked for me is as follows:
Stop apache2.
sudo service apache2 stop
Uninstall Apache2 and its dependent packages.
sudo apt-get purge apache2 apache2-utils apache2.2-bin apache2-common
//or
sudo apt-get purge apache2 apache2-utils apache2-bin apache2.2-common
Use autoremove option to get rid of other dependencies.
sudo apt-get autoremove
Check whether there are any configuration files that have not been removed.
whereis apache2
If you get a response as follows apache2: /etc/apache2 remove the directory and existing configuration files.
sudo rm -rf /etc/apache2

View File

@ -0,0 +1,344 @@
<p dir="rtl" align="center">
بسم الله الرحمن الرحیم
<br></p>
# <p dir="rtl" align="right"> 1-نصب nginx </p> #
<br><p dir="rtl" align="right">
برای نصب nginx، دستور زیر را در خط فرمان وارد کنید:
</p>
```r
sudo apt update
sudo apt install nginx
```
<p dir="rtl" align="right">
بررسی کنید که nginx در حال اجرا است
</p>
```r
sudo systemctl status nginx
```
<p style="background-color:black;color:white;">
<code>
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2023-08-20 01:04:22 UTC; 53s ago
Docs: man:nginx(8)
Process: 28210 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SU\
CCESS)
Process: 28211 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Main PID: 28312 (nginx)
Tasks: 13 (limit: 76969)
Memory: 13.1M
CPU: 105ms
CGroup: /system.slice/nginx.service
├─28312 "nginx: master process /usr/sbin/nginx -g daemon on; master_process on;"
├─28314 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
...
</code>
</p>
<p dir="rtl" align="right">
برای راه اندازی مجدد nginx، اجرا کنید:
</p>
```r
sudo systemctl restart nginx
```
<p dir="rtl" align="right">
nginx را به صورت دستی فعال/غیرفعال کنید
</p>
```r
sudo systemctl disable nginx
```
<p dir="rtl" align="right">
سپس برای فعال کردن مجدد آن، اجرا کنید:
</p>
```r
sudo systemctl enable nginx
```
<p dir="rtl" align="justify">
یک صفحه اصلی پیش فرض nginx نیز در طول مراحل نصب تنظیم می شود. می توانید این صفحه را با استفاده از آدرس IP سرور وب خود در مرورگر بارگذاری کنید. زیر
</p>
```r
http://localhost
```
# <p dir="rtl" align="right">2-پیکر بندی </p> #
## <p dir="rtl" align="right">بلوک های سرور </p> ##
<p dir="rtl" align="justify">
nginx مجموعه‌ای از جزئیات پیکربندی خاص سایت را در بلوک‌های سرور سازمان‌دهی می‌کند و به طور پیش‌فرض برای عملیات تک سایتی از پیش پیکربندی شده است. این می تواند به عنوان "همانطور که هست" یا به عنوان یک الگوی شروع استفاده شود
برای سرویس دهی به چندین سایت
<br>
پیکربندی تک سایت، فایل‌های خارج از /var/www/html را همانطور که توسط بلوک سرور تعریف شده و توسط /etc/nginx/sites-enabled/default ارائه شده است، ارائه می‌کند:
<br></p>
## <p dir="rtl" align="right">پیکربندی تک سایت </p> ##
```r
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
}
```
<p dir="rtl" align="justify">
حتی برای پیکربندی یک سایت، در حالی که می توانید وب سایت خود را در /var/www/html قرار دهید، ممکن است بخواهید فایل های وب سایت را در مکان دیگری در سیستم فایل خود قرار دهید. به عنوان مثال، اگر میزبان www.my-site.org از /srv/my-site/html بودید، ممکن است فایل فوق را به شکل زیر ویرایش کنید:
</p>
```r
server {
listen 80;
root /srv/my-site/html;
index index.html index.php;
server_name localhost my-site.org www.my-site.org;
location / {
try_files $uri $uri/ =404;
}
}
```
<p dir="rtl" align="right">
مطمئن شوید که ساختار دایرکتوری ریشه وب خود را ایجاد کرده اید:
</p>
```r
sudo mkdir -p /srv/my-site/html
sudo chmod -R 755 /srv/my-site/html
echo "<html><body><h1>My Site!</h1></body></html>" > /srv/my-site/html/index.html
```
<p dir="rtl" align="right">
سپس، برای اینکه nginx پیکربندی خود را دوباره بارگذاری کند، اجرا کنید:
</p>
```r
sudo systemctl reload nginx
```
<p dir="rtl" align="right">
بررسی کنید که تنظیمات با استفاده از مرورگر وب شما اعمال شده باشند:
</p>
```r
http://localhost
```
## <p dir="rtl" align="right"> پیکربندی چند سایتی </p> ##
<p dir="rtl" align="justify">
مشابه آپاچی، nginx از دایرکتوری های سایت های در دسترس و سایت های فعال برای پیکربندی چندین وب سایت استفاده می کند. برخلاف آپاچی، باید فعال سازی را به صورت دستی مدیریت کنید.
<br>
برای انجام این کار، ابتدا یک بلوک سرور جدید در یک فایل پیکربندی مانند بالا ایجاد کنید و آن را در /etc/nginx/sites-available/<your-domain> ذخیره کنید. مطمئن شوید که به هر سایت یک server_name منحصربفرد و یک listen port number متفاوت بدهید.
<br>
در مرحله بعد، سایت را با ایجاد یک پیوند از آن فعال کنید sites-enabled .
</p>
```r
sudo ln -s /etc/nginx/sites-available/<your-domain> /etc/nginx/sites-enabled/
```
<p dir="rtl" align="justify">
برای غیرفعال کردن یک وب‌سایت، می‌توانید پیوند نمادین را در سایت‌های فعال حذف کنید. به عنوان مثال، هنگامی که سایت(های) جدید خود را پیکربندی کردید و دیگر به پیکربندی سایت پیش فرض نیاز ندارید:
</p>
```r
sudo rm /etc/nginx/sites-available/default
```
## <p dir="rtl" align="right"> SSL and HTTPS </p> ##
<p dir="rtl" align="justify">
در حالی که ایجاد یک وب‌سایت HTTP در پورت 80 نقطه شروع خوبی است (و شاید برای محتوای ثابت کافی باشد)، سیستم‌های تولید HTTPS را می‌خواهند، مانند سرویس در پورت 443 با SSL فعال از طریق فایل‌های cert. یک بلوک سرور با چنین پیکربندی ممکن است به شکل زیر باشد:
</p>
```r
server {
listen 443 ssl;
root /var/www/html;
return 301 https://$host$request_url;
root /srv/our-site/html;
index index.html;
server_name our-site.org www.our-site.org;
ssl_certificate our-site.org.crt;
ssl_certificate_key our-site.org.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_session_timeout 15m;
location / {
try_files $uri $uri/ =404;
}
}
```
<p dir="rtl" align="justify">
به لطف خط بازگشتی 301 در پیکربندی بالا، هر کسی که از سایت در پورت 80 از طریق یک URL HTTP بازدید می کند، به طور خودکار به URL امن HTTPS معادل هدایت می شود.
<br>
برای جزئیات بیشتر در مورد نحوه ایجاد و مدیریت گواهی‌ها، و برای جزئیات بیشتر در مورد پیکربندی و استفاده از آن سرویس، به صفحه امنیت - گواهی‌ها در این راهنما مراجعه کنید. بخش GnuTLS نحوه پیکربندی نسخه های مختلف پروتکل SSL و رمزهای مرتبط با آنها را توضیح می دهد.
<br>
به عنوان مثال، برای ایجاد یک گواهی خود امضا شده، ممکن است مجموعه ای از دستورات مشابه این را اجرا کنید:
</p>
```r
sudo openssl genrsa -out our-site.org.key 2048
openssl req -nodes -new -key our-site.org.key -out ca.csr
openssl x509 -req -days 365 -in our-site.org.csr -signkey our-site.org.key -out our-site.org.crt
mkdir /etc/apache2/ssl
cp our-site.org.crt our-site.org.key our-site.org.csr /etc/apache2/ssl/
```
# <p dir="rtl" align="right"> 3-نحوه استفاده از ماژول های nginx </p> #
<p dir="rtl" align="justify">
مانند سایر وب سرورها، nginx از ماژول های بارگذاری شده پویا برای ارائه پشتیبانی درون سرور برای زبان های برنامه نویسی، مکانیسم های امنیتی و غیره پشتیبانی می کند. اوبونتو تعدادی از این ماژول‌ها را به‌عنوان بسته‌های جداگانه ارائه می‌کند که یا همزمان با nginx نصب می‌شوند، یا می‌توان آنها را جداگانه نصب کرد.
ماژول های موجود
<br>
nginx ماژول هایی را که با آنها ساخته شده است از طریق گزینه -V گزارش می دهد. یک راه سریع و کثیف برای فهرست کردن ماژول های موجود بدین صورت است:
</p>
```r
nginx -V 2>&1 | tr -- - '\n' | grep _module
```
<p style="background-color:black;color:white;">
<code>
خروجی:<br>
http_ssl_module
http_stub_status_module
http_realip_module
...
http_image_filter_module=dynamic
http_perl_module=dynamic
http_xslt_module=dynamic
stream_geoip_module=dynamic
</code>
</p>
<p dir="rtl" align="justify">
بسیاری از این ماژول ها داخلی هستند و بنابراین همیشه با nginx در دسترس هستند، اما برخی به عنوان بسته های جداگانه وجود دارند که وضعیت نصب آنها را می توان از طریق apt بررسی کرد. مثلا:
</p>
```r
apt policy libnginx-mod-http-image-filter
```
<p style="background-color:black;color:white;">
<code>
خروجی:<br>
libnginx-mod-http-image-filter:
Installed: (none)
Candidate: 1.24.0-1ubuntu1
Version table:
1.24.0-1ubuntu1 500
500 http://archive.ubuntu.com/ubuntu mantic/main amd64 Packages
</code>
</p>
<p dir="rtl" align="right">
از apt نیز می توان برای نصب ماژول پویا مورد نظر استفاده کرد:
</p>
```r
sudo apt install libnginx-mod-http-image-filter
```
<p style="background-color:black;color:white;">
<code>
خروجی:<br>
...
The following NEW packages will be installed:
libnginx-mod-http-image-filter
0 upgraded, 1 newly installed, 0 to remove and 34 not upgraded.
...
Triggering nginx reload
...
</code>
</p>
<p dir="rtl" align="justify">
فعال و غیرفعال کردن ماژول های پویا
<br>
ماژول های پویا به طور خودکار فعال می شوند و در هنگام نصب توسط nginx بارگذاری مجدد می شوند. اگر نیاز دارید که یک ماژول نصب شده را به صورت دستی غیرفعال کنید، فایل آن را از پوشه /etc/nginx/modules-enabled حذف کنید، برای مثال:
</p>
```r
$ ls /etc/nginx/modules-*
```
<p style="background-color:black;color:white;">
<code>
خروجی:<br>
/etc/nginx/modules-available:
/etc/nginx/modules-enabled:
50-mod-http-image-filter.conf
</code>
</p>
```r
$ sudo mv /etc/nginx/modules-enabled/50-mod-http-image-filter.conf /etc/nginx/modules-available/
$ service nginx restart
```
<p dir="rtl" align="right">
توجه داشته باشید که ماژول های داخلی را نمی توان غیرفعال/فعال کرد.
</p>
## <p dir="rtl" align="right"> پیکربندی ماژول ها </p> ##
```r
## /etc/nginx/modules-enabled/50-mod-http-image-filter.conf
load_module modules/ngx_http_image_filter_module.so;
```
<p dir="rtl" align="justify">
توجه داشته باشید که اگر بنا به دلایلی ترجیح داده می شود، می توانید از پارامتر load_module در /etc/nginx/nginx.conf خود در سطح بالا نیز استفاده کنید.
<br>
برای استفاده از یک ماژول برای وب سایت خود، تنظیمات آن در بلوک سرور شما مشخص شده است. مثلا:
</p>
```r
location /img/ {
image_filter resize 240 360;
image_filter rotate 180;
image_filter_buffer 16M;
error_page 415 = /415.html;
}
```
<pre>
منبع:<br>
[نحوه نصب Nginx](https://ubuntu.com/server/docs/how-to-install-nginx)<br>
[نحوه پیکربندی nginx](https://ubuntu.com/server/docs/how-to-configure-nginx)<br>
[نحوه استفاده از ماژول های nginx](https://ubuntu.com/server/docs/how-to-use-nginx-modules)<br>
</pre>
<p dir="rtl" align="center">صلوات</p>

View File

@ -0,0 +1,82 @@
## 1. Installing Nginx ##
To install Nginx, use following command:
sudo apt update
sudo apt install nginx
After installing it, you already have everything you need.
You can point your browser to your server IP address. You should see this page:
Welcome to nginx
If you see this page, you have successfully installed Nginx on your web server.
## 2. Creating our own website ##
Default page is placed in /var/www/html/ location. You can place your static pages here, or use virtual host and place it other location.
Virtual host is a method of hosting multiple domain names on the same server.
Lets create simple HTML page in /var/www/tutorial/ (it can be anything you want). Create index.html file in this location.
cd /var/www
sudo mkdir tutorial
cd tutorial
sudo "${EDITOR:-vi}" index.html
Paste the following to the index.html file:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Hello, Nginx!</title>
</head>
<body>
<h1>Hello, Nginx!</h1>
<p>We have just configured our Nginx web server on Ubuntu Server!</p>
</body>
</html>
Save this file. In next step we are going to set up virtual host to make Nginx use pages from this location.
## 3. Setting up virtual host ##
To set up virtual host, we need to create file in /etc/nginx/sites-enabled/ directory.
For this tutorial, we will make our site available on 81 port, not the standard 80 port. You can change it if you would like to.
cd /etc/nginx/sites-enabled
sudo "${EDITOR:-vi}" tutorial
server {
listen 81;
listen [::]:81;
server_name example.ubuntu.com;
root /var/www/tutorial;
index index.html;
location / {
try_files $uri $uri/ =404;
}
}
root is a directory where we have placed our .html file. index is used to specify file available when visiting root directory of site. server_name can be anything you want, because you arent pointing it to any real domain by now.
## 4. Activating virtual host and testing results ##
To make our site working, simply restart Nginx service.
sudo service nginx restart
Lets check if everything works as it should. Open our newly created site in web browser. Remember that we used :81 port.
hhtp://localhost:81
## Final ##
Congratulations! Everything works as it should. We have just configured Nginx web server.

View File

@ -0,0 +1,184 @@
<p dir="rtl" align="center"> بسم الله الرحمن الرحیم </p>
# <p dir="rtl" align="center">نحوه نصب MariaDB در Ubuntu 22.04</p> #
<p dir="rtl" align="right">معرفی
<br>
MariaDB یک سیستم مدیریت پایگاه داده رابطه‌ای منبع باز است که معمولاً به عنوان جایگزینی برای MySQL به عنوان بخش پایگاه داده پشته <br>محبوب LAMP (Linux، Apache، MySQL، PHP/Python/Perl) استفاده می‌شود. در نظر گرفته شده است که جایگزینی برای MySQL باشد.
<br>
نسخه کوتاه این راهنمای نصب شامل این سه مرحله است:<br>
<br>
فهرست بسته خود را با استفاده از apt به روز کنید<br>
بسته mariadb-server را با استفاده از apt نصب کنید. این بسته همچنین ابزارهای مرتبط را برای تعامل با MariaDB می‌کِشد<br>
اسکریپت امنیتی mysql_secure_installation را اجرا کنید تا دسترسی به سرور را محدود کنید
</p>
<p dir="rtl" align="right">به روز رسانیها را بررسی کنید و قبل از انجام هر اقدام دیگری آنها را نصب کنید. </p>
```groovy
sudo apt update
sudo apt install mariadb-server
sudo mysql_secure_installation
```
## <p dir="rtl" align="right"> گام اول: نصب MariaDB </p> ##
<p dir="rtl" align="right">از زمان نگارش این مقاله، مخازن APT پیش‌فرض اوبونتو 22.04 شامل MariaDB نسخه 10.5.12 است.
برای نصب آن، فهرست بسته را در سرور خود با apt به روز کنید:</p>
```groovy
sudo apt update
```
سپس بسته را نصب کنید:
```groovy
sudo apt install mariadb-server
```
<p dir="rtl" align="right">این دستورات MariaDB را نصب می‌کنند، اما از شما خواسته نمی‌شود رمز عبور تعیین کنید یا تغییرات دیگری در پیکربندی انجام دهید. از آنجایی که پیکربندی پیش‌فرض نصب MariaDB شما را ناامن می‌کند، از اسکریپتی استفاده می‌کنید که بسته mariadb-server برای محدود کردن دسترسی به سرور و حذف حساب‌های استفاده نشده ارائه می‌کند.</p>
## <p dir="rtl" align="right">گام دوم - پیکربندی MariaDB </p> ##
<p dir="rtl" align="right"> برای نصب های جدید MariaDB، گام بعدی اجرای اسکریپت امنیتی موجود است. این اسکریپت برخی از گزینه های پیش فرض کمتر امن را برای مواردی مانند ورود به سیستم ریشه از راه دور و کاربران نمونه تغییر می دهد.</p>
<br>
<p dir="rtl" align="right">اسکریپت امنیتی را اجرا کنید:</p>
```groovy
sudo mysql_secure_installation
```
<p dir="rtl" align="right">این شما را از طریق یک سری دستورات راهنمایی می کند که در آن می توانید برخی تغییرات را در گزینه های امنیتی نصب MariaDB خود ایجاد کنید. اولین اعلان از شما می خواهد که رمز عبور اصلی پایگاه داده فعلی را وارد کنید. از آنجایی که هنوز یکی را تنظیم نکرده‌اید، ENTER را فشار دهید تا «none» را نشان دهید.
</p>
<br>
<p dir="rtl" align="right" style="background-color: rgb(50, 50, 50); color:white">
خروجی:
<br>
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB<br>
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!<br>
<br>
In order to log into MariaDB to secure it, you'll need the current<br>
password for the root user. If you've just installed MariaDB, and<br>
you haven't set the root password yet, the password will be blank,<br>
so you should just press enter here.<br>
<br>
Enter current password for root (enter for none):<br>
</p>
<p dir="rtl" align="right">از شما پرسیده می شود که آیا می خواهید به احراز هویت سوکت یونیکس سوئیچ کنید. از آنجایی که از قبل یک حساب ریشه محافظت شده دارید، می توانید از این مرحله صرف نظر کنید. n را تایپ کرده و سپس ENTER را فشار دهید.</p>
<br>
<p dir="rtl" align="right" style="background-color: rgb(50, 50, 50); color:white">
خروجی:
<br>
. . .
Setting the root password or using the unix_socket ensures that nobody<br>
can log into the MariaDB root user without the proper authorisation.<br>
<br>
You already have your root account protected, so you can safely answer 'n'.<br>
<br>
Switch to unix_socket authentication [Y/n] n<br>
</p>
<p dir="rtl" align="right">
بعداً، در صورتی که احراز هویت سوکت برای مورد استفاده شما مناسب نباشد، نحوه راه‌اندازی یک حساب اداری اضافی برای دسترسی رمز عبور را بررسی خواهید کرد.
<br>
از آنجا، می‌توانید Y و سپس ENTER را فشار دهید تا پیش‌فرض‌ها را برای تمام سؤالات بعدی بپذیرید. با این کار برخی از کاربران ناشناس و پایگاه داده آزمایشی حذف می‌شوند، ورود به سیستم ریشه از راه دور غیرفعال می‌شود و این قوانین جدید بارگیری می‌شود تا MariaDB فوراً تغییراتی را که ایجاد کرده‌اید پیاده‌سازی کند.
<br>
با آن، پیکربندی امنیتی اولیه MariaDB را به پایان رساندید. مرحله بعدی یک مرحله اختیاری است، اگرچه اگر ترجیح می دهید با یک رمز عبور در سرور MariaDB خود احراز هویت شوید، باید آن را دنبال کنید.
</p>
## <p dir="rtl" align="right">گام سوم- (اختیاری) ایجاد یک کاربر اداری که از احراز هویت رمز عبور استفاده می کند</p>
<p dir="rtl" align="right">
در سیستم‌های اوبونتو که MariaDB 10.5 را اجرا می‌کنند، کاربر root MariaDB به‌طور پیش‌فرض و نه با رمز عبور، با استفاده از افزونه unix_socket احراز هویت می‌شود. این امر در بسیاری از موارد امنیت و قابلیت استفاده بیشتر را فراهم می‌کند، اما همچنین می‌تواند در مواردی که نیاز به اجازه دادن به یک برنامه خارجی (مثلاً phpMyAdmin) حقوق مدیریتی دارید، شرایط را پیچیده‌تر کند.
<br>
از آنجایی که سرور از حساب ریشه برای کارهایی مانند چرخش گزارش و راه‌اندازی و توقف سرور استفاده می‌کند، بهتر است جزئیات احراز هویت حساب ریشه را تغییر ندهید. تغییر اعتبار در فایل پیکربندی /etc/mysql/debian.cnf ممکن است در ابتدا کار کند، اما به‌روزرسانی‌های بسته به طور بالقوه می‌توانند این تغییرات را بازنویسی کنند. به جای تغییر حساب ریشه، نگهدارندگان بسته توصیه می کنند یک حساب اداری جداگانه برای دسترسی مبتنی بر رمز عبور ایجاد کنید.
<br>
برای این منظور، یک حساب کاربری جدید به نام admin با همان قابلیت‌های اکانت root ایجاد می‌کنیم، اما برای احراز هویت رمز عبور پیکربندی شده است. درخواست MariaDB را از ترمینال خود باز کنید:
</p>
```groovy
MariaDB [(none)]> sudo mariadb
```
<p dir="rtl" align="right">
سپس یک کاربر جدید با حقوق ریشه و دسترسی مبتنی بر رمز عبور ایجاد کنید. حتماً نام کاربری و رمز عبور را تغییر دهید تا با تنظیمات برگزیده شما مطابقت داشته باشد:
</p>
```groovy
MariaDB [(none)]> GRANT ALL ON *.* TO 'admin'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
```
<p dir="rtl" align="right">
برای اطمینان از ذخیره و در دسترس بودن آنها در جلسه جاری، امتیازات را پاک کنید:
</p>
```groovy
MariaDB [(none)]> FLUSH PRIVILEGES;
```
<p dir="rtl" align="right">
پس از این، از پوسته MariaDB خارج شوید:
</p>
```groovy
MariaDB [(none)]> exit;
```
<p dir="rtl" align="right">
در نهایت، اجازه دهید نصب MariaDB را آزمایش کنیم.
</p>
مرحله 4 - آزمایش MariaDB
<p dir="rtl" align="right">
هنگامی که از مخازن پیش فرض نصب می شود، MariaDB به طور خودکار شروع به اجرا می کند. برای تست این، وضعیت آن را بررسی کنید.
</p>
```groovy
sudo systemctl status mariadb
```
<p dir="rtl" align="right">
خروجی مشابه زیر دریافت خواهید کرد:
</p>
<p style="background-color: rgb(50, 50, 50); color:white">
Output
● mariadb.service - MariaDB 10.5.12 database server<br>
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)<br>
Active: active (running) since Fri 2022-03-11 22:01:33 UTC; 14min ago<br>
Docs: man:mariadbd(8)<br>
https://mariadb.com/kb/en/library/systemd/<br>
. . .
</p>
<p dir="rtl" align="right">
اگر MariaDB اجرا نمی شود، می توانید آن را با دستور sudo systemctl start mariadb شروع کنید.
<br>
برای بررسی بیشتر، می‌توانید با استفاده از ابزار mysqladmin، که یک کلاینت است که به شما امکان اجرای دستورات مدیریتی را می‌دهد، به پایگاه داده متصل شوید. به عنوان مثال، این دستور می گوید که با استفاده از سوکت یونیکس به عنوان root به MariaDB متصل شوید و نسخه را برگردانید:
</p>
```groovy
sudo mysqladmin version
```
خروجی مشابه این را دریافت خواهید کرد:
<p style="background-color: rgb(50, 50, 50); color:white">
output
mysqladmin Ver 9.1 Distrib 10.5.12-MariaDB, for debian-linux-gnu on x86_64 <br>
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.<br>
<br>
Server version 10.5.12-MariaDB-1build1<br>
Protocol version 10<br>
Connection Localhost via UNIX socket<br>
UNIX socket /run/mysqld/mysqld.sock<br>
Uptime: 15 min 53 sec<br>
<br>
Threads: 1 Questions: 482 Slow queries: 0 Opens: 171 Open tables: 28 Queries per second avg: 0.505<br>
</p>
## <p dir="rtl" align="right">نتیجه </p> ##
<p dir="rtl" align="right">
در این راهنما شما سیستم مدیریت پایگاه داده رابطه‌ای MariaDB را نصب کردید و با استفاده از اسکریپت mysql_secure_installation که با آن نصب شده بود، آن را ایمن کردید. شما همچنین این گزینه را داشتید که یک کاربر اداری جدید ایجاد کنید که از احراز هویت رمز عبور قبل از آزمایش عملکرد سرور MariaDB استفاده می کند.<br>
<br>
اکنون که یک سرور MariaDB در حال اجرا و ایمن دارید، در اینجا چند نمونه از مراحل بعدی که می توانید برای کار با سرور بردارید، در اینجا مشاهده کنید:<br>
</p>
* Learn how to import and export databases
* Practice running SQL queries
* Incorporate MariaDB into a larger application stack
## <p dir="rtl" align="right">[منبع](https://www.digitalocean.com/community/tutorials/how-to-install-mariadb-on-ubuntu-22-04) </p> ##
<p dir="rtl" align="center"> صلوات </p>

View File

@ -0,0 +1,23 @@
<p dir="rtl" align="center">بسم الله الرحمن الرحیم</p>
# <p dir="rtl" align="center">عنوان</p> #
## <p dir="rtl" align="right">گام اول: اینکه</p> ##
<p dir="rtl" align="right"></p>
<p style="background-color:black;color:white;" >
<code>
server{
dir=""
}
</code>
</p>
```r
sudo apt-get install <package>
```
<p dir="rtl" align="center">صلوات</p>

View File

@ -0,0 +1,41 @@
<p dir="rtl" align="center">بسم الله الرحمن الرحیم</p>
<p dir="rtl" align="right">برای حذف اساسی و اصولی MariaDB و نصب مجدد آن می توان از روال زیر بهره برد</p>
## <p dir="rtl" align="right">الف: حذف اساسی یا سختِ MariaDB</p> ##
## <p dir="rtl" align="right">اگر mysql را نصب کرده اید، آن را حذف کرده و امتحان کنید.</p> ##
```r
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean
```
# <p dir="rtl" align="right"> این دستورات همه پایگاه های داده موجود شما را پاک می کند </p> #
```r
sudo rm -rf /var/lib/mysql
sudo rm -rf /etc/mysql
```
## <p dir="rtl" align="right">ب: نصب دوباره MariaDB</p> ##
```r
sudo apt install mariadb-server mariadb-client
sudo mysql_secure_installation
sudo mariadb
```
<p dir="rtl" align="right"> خط فرمان به صورت زیر نمایش داده می شود.</p>
<p style="background-color:black;color:white;"> MariaDB[(none)]&gt; </p>
```r
GRANT ALL ON *.* TO 'admin'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT;
```
<p dir="rtl" align="right"> برای خروج می توان به جای دستور EXIT از دستور QUIT استفاده کرد.</p>
<p dir="rtl" align="center">صلوات</p>

View File

@ -0,0 +1,93 @@
<p align="center" dir="rtl">بسم الله الرحمن الرحیم</p>
# <p align="right" dir="rtl" >PHP نصب</p> #
<p align="right" dir="rtl" >
PHP در لینوکس اوبونتو موجود است، اما برخلاف پایتون (که از پیش نصب شده است)، باید به صورت دستی نصب شود.
<br>
برای نصب PHP و ماژول Apache PHP می‌توانید دستور زیر را در خط فرمان وارد کنید:
</p>
```r
sudo apt install php libapache2-mod-php
```
# <p align="right" dir="rtl" > نصب بسته های اختیاری </p> #
<p align="right" dir="rtl" > بسته‌های زیر اختیاری هستند و در صورت نیاز برای راه‌اندازی، می‌توان آن‌ها را نصب کرد. </p>
PHP-CLI
<p align="justify" dir="rtl" >
شما می توانید اسکریپت های PHP را از طریق رابط خط فرمان (CLI) اجرا کنید. برای این کار ابتدا باید بسته php-cli را نصب کنید. با اجرای دستور زیر می توانید آن را نصب کنید:
</p>
```r
sudo apt install php-cli
```
PHP-CGI
<p align="justify" dir="rtl" >
همچنین می توانید اسکریپت های PHP را بدون نصب ماژول PHP آپاچی اجرا کنید. برای انجام این کار، باید بسته php-cgi را از طریق این دستور نصب کنید:
</p>
```r
sudo apt install php-cgi
```
PHP-MySQL
<p align="right" dir="rtl" >
برای استفاده از MySQL با PHP باید بسته php-mysql را نصب کنید، مانند:
</p>
```r
sudo apt install php-mysql
```
PHP-PgSQL
<p align="right" dir="rtl" >
به طور مشابه، برای استفاده از PostgreSQL با PHP باید بسته php-pgsql را نصب کنید:
</p>
```r
sudo apt install php-pgsql
```
# <p align="right" dir="rtl" >پیکربندی PHP</p> #
<p align="justify" dir="rtl" >
اگر بسته‌های libapache2-mod-php یا php-cgi را نصب کرده‌اید، می‌توانید اسکریپت‌های PHP را از مرورگر وب خود اجرا کنید. اگر بسته php-cli را نصب کرده اید، می توانید اسکریپت های PHP را در یک فرمان ترمینال اجرا کنید.
<br>
به طور پیش فرض، زمانی که libapache2-mod-php نصب می شود، وب سرور Apache2 برای اجرای اسکریپت های PHP با استفاده از این ماژول پیکربندی شده است. ابتدا بررسی کنید که فایل های /etc/apache2/mods-enabled/php8.*.conf و /etc/apache2/mods-enabled/php8.*.load وجود دارند یا خیر. اگر آنها وجود ندارند، می توانید ماژول را با استفاده از دستور a2enmod فعال کنید.
<br>
هنگامی که بسته های مرتبط با PHP را نصب کردید و ماژول Apache PHP را فعال کردید، باید وب سرور Apache2 را برای اجرای اسکریپت های PHP با اجرای دستور زیر مجددا راه اندازی کنید:
</p>
```r
sudo systemctl restart apache2
```
<p align="right" dir="rtl" >
تنظیمات خود را تست کنید
<br>
برای تأیید نصب خود، می توانید اسکریپت phpinfo زیر را اجرا کنید:
</p>
```r
<?php
phpinfo();
?>
```
<p align="right" dir="rtl" >
می‌توانید محتوا را در یک فایل ذخیره کنید - برای مثال phpinfo.php - و آن را در فهرست DocumentRoot سرور وب Apache2 قرار دهید. با اشاره مرورگر خود به http://hostname/phpinfo.php مقادیر پارامترهای مختلف پیکربندی PHP نمایش داده می شود.
</p>
[منبع](https://ubuntu.com/server/docs/programming-php)
<p align="center" dir="rtl" >صلوات</p>

121
7-PHP/2-PHP/0-minimal.md Normal file
View File

@ -0,0 +1,121 @@
<p dir="rtl" align="center">بسم الله الرحمن الرحیم</p>
# <p align="right" dir="rtl">نصب PHP </p>
<p align="right" dir="rtl">
</p>
```r
sudo apt-get update && sudo apt-get upgrade
sudo apt autoremove
```
<p align="right" dir="rtl">
گزینه (--dry-run) نصب حداقلی را انجام می دهد:
</p>
```r
sudo apt-get install --dry-run php
```
<p align="right" dir="rtl">
حال PHP را نصب می کنیم:
<br>
گام 1: به روز رسانی مخازن سیستم
</p>
```r
sodu apt-get update && apt-get upgrade
```
<p align="right" dir="rtl">
گام 2: وابستگی های مورد نیاز را نصب کنید
</p>
```r
sudo apt install -y lsb-release gnupg2 ca-certificates apt-transport-https software-properties-common
```
<p align="right" dir="rtl">
گام 3: مخزن PHP را راه اندازی کنید
</p>
```r
sudo add-apt-repository ppa:ondrej/php
```
<p align="right" dir="rtl">
برای ادامه خواندن اعلان، لطفاً دکمه "Enter" را فشار دهید:
<br>
گام 4: نصب PHP 8.2 در Ubuntu 22.04
</p>
```r
sudo apt update
sudo apt install php8.2
```
<p align="right" dir="rtl">
گام 5: بررسی نسخه PHP
</p>
```r
php -v
```
<p align="right" dir="rtl">
گام 6: نصب افزونه های PHP8
```r
apt install php8.0-cli php8.0-common php8.0-imap php8.0-redis php8.0-xml php8.0-zip php8.0-mbstring
```
<p align="right" dir="rtl">
گام 7: بررسی ماژولهای نصب شده:
</p>
```r
php -m
```
<p style="background-color:black;color:white;">
<code>
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
.
.
.
<br>
[Zend Modules]
Zend OPcache
</code>
</p>
<p align="right" dir="rtl">
بررسی نسخه PHP:
</p>
```r
php -version
```
یا
```r
php -v
```
<p style="background-color:black;color:white;">
<code>
PHP 8.2.12 (cli) (built: Oct 26 2023 17:33:26) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.12, Copyright (c) Zend Technologies
with Zend OPcache v8.2.12, Copyright (c), by Zend Technologies
</code>
</p>
<p dir="rtl" align="center">صلوات</p>

View File

@ -0,0 +1,23 @@
<p dir="rtl" align="center">بسم الله الرحمن الرحیم</p>
# <p dir="rtl" align="center">عنوان</p> #
## <p dir="rtl" align="right">گام اول: اینکه</p> ##
<p dir="rtl" align="right"></p>
<p style="background-color:black;color:white;" >
<code>
server{
dir=""
}
</code>
</p>
```r
sudo apt-get install <package>
```
<p dir="rtl" align="center">صلوات</p>

171
7-PHP/2-PHP/more/minimal.md Normal file
View File

@ -0,0 +1,171 @@
<p dir="rtl" align="center">بسم الله الرحمن الرحیم</p>
# <p align="right" dir="rtl">نصب PHP </p>
<p align="right" dir="rtl">
گزینه (--dry-run) نصب حداقلی را انجام می دهد:
</p>
```r
sudo apt-get install --dry-run php
```
<p align="right" dir="rtl">
حال PHP را نصب می کنیم:
</p>
```r
sodu apt-get update && apt-get upgrade
```
<p align="right" dir="rtl">
گام 1: به روزرسانی سیستم اوبونتو
</p>
```r
sudo apt update && sudo apt -y upgrade
```
<p align="right" dir="rtl">
پس از ارتقا، کش APT را پاک کنید.
</p>
```r
sudo apt autoremove
```
<p align="right" dir="rtl">
بررسی کنید که آیا نیاز به راه اندازی مجدد است یا خیر و مطابق با آن عمل کنید.
</p>
```r
[ -f /var/run/reboot-required ] && sudo reboot -f
```
<p align="right" dir="rtl">
جزئیات انتشار سیستم عامل را می توان با استفاده از دستورات داده شده در اینجا بررسی کرد.
</p>
```r
cat /etc/os-release
```
<p style="background-color:black;color:white;">
<code>
PRETTY_NAME="Ubuntu 22.04.1 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.1 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy
</code>
</p>
<p align="right" dir="rtl">
گام 2: مخزن APT را اضافه کنید
</p>
sudo apt update
sudo apt install -y lsb-release gnupg2 ca-certificates apt-transport-https software-properties-common
sudo add-apt-repository ppa:ondrej/php
<p style="background-color:black;color:white;">
<code>
Expected successful command execution.
...
<br>
# LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
More info: https://launchpad.net/~ondrej/+archive/ubuntu/php
Adding repository.
Press [ENTER] to continue or Ctrl-c to cancel.
Adding deb entry to /etc/apt/sources.list.d/ondrej-ubuntu-php-jammy.list
Adding disabled deb-src entry to /etc/apt/sources.list.d/ondrej-ubuntu-php-jammy.list
Adding key to /etc/apt/trusted.gpg.d/ondrej-ubuntu-php.gpg with fingerprint 14AA40EC0831756756D7F66C4F4EA0AAE5267A6C
Hit:1 https://mirror.hetzner.com/ubuntu/packages jammy InRelease
Hit:2 https://mirror.hetzner.com/ubuntu/packages jammy-updates InRelease
Hit:3 https://mirror.hetzner.com/ubuntu/packages jammy-backports InRelease
Hit:4 https://mirror.hetzner.com/ubuntu/security jammy-security InRelease
Get:5 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy InRelease [23.9 kB]
Get:6 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 Packages [108 kB]
Get:7 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main Translation-en [33.3 kB]
Fetched 166 kB in 1s (120 kB/s)
Reading package lists... Done
</code>
</p>
<p align="right" dir="rtl">
با اجرای دستور apt update می توانید به صورت دستی تأیید کنید که مخزن کار می کند.
```r
sudo apt update
```
<p style="background-color:black;color:white;">
<code>
Hit:1 https://mirror.hetzner.com/ubuntu/packages jammy InRelease
Hit:2 https://mirror.hetzner.com/ubuntu/packages jammy-updates InRelease
Hit:3 https://mirror.hetzner.com/ubuntu/packages jammy-backports InRelease
Hit:4 https://mirror.hetzner.com/ubuntu/security jammy-security InRelease
Hit:5 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
</code>
</p>
<p align="right" dir="rtl">
گام 3: نصب PHP 8.2 در Ubuntu
</p>
```r
sudo apt install php8.2
```
<p style="background-color:black;color:white;">
<code>
Accept package installation as requested via prompt.
The following additional packages will be installed:
apache2 apache2-bin apache2-data apache2-utils bzip2 file libapache2-mod-php8.2 libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.3-0 mailcap mime-support php-common
php8.2-cli php8.2-common php8.2-opcache php8.2-readline ssl-cert
Suggested packages:
apache2-doc apache2-suexec-pristine | apache2-suexec-custom www-browser bzip2-doc php-pear
The following NEW packages will be installed:
apache2 apache2-bin apache2-data apache2-utils bzip2 file libapache2-mod-php8.2 libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.3-0 mailcap mime-support php-common php8.2
php8.2-cli php8.2-common php8.2-opcache php8.2-readline ssl-cert
0 upgraded, 21 newly installed, 0 to remove and 2 not upgraded.
Need to get 6,990 kB of archives.
After this operation, 29.8 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
..
</code>
</p>
<p align="right" dir="rtl">
بررسی نسخه PHP:
</p>
```r
php -v
```
یا
```r
php --version
```
<p style="background-color:black;color:white;">
<code>
PHP 8.2.7 (cli) (built: Jun 8 2023 15:27:40) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.7, Copyright (c) Zend Technologies
with Zend OPcache v8.2.7, Copyright (c), by Zend Technologies
</code>
</p>
<p dir="rtl" align="center">صلوات</p>

View File

@ -0,0 +1,398 @@
<p dir="rtl" align="center"> بسم الله الرحمن الرحیم </p>
# <p dir="rtl" align="center"> نحوه نصب PHP 8.2 روی Ubuntu 22.04|20.04|18.04 </p> #
## <p dir="rtl" align="right"> گام اول: به روزرسانی سیستم اوبونتو </p> ##
<p dir="rtl" align="right">به روز رسانیها را بررسی کنید و قبل از انجام هر اقدام دیگری آنها را نصب کنید. </p>
```r
sudo apt update && sudo apt -y upgrade
```
<p dir="rtl" align="right"> پس از ارتقا، کش APT را پاک کنید.</p>
```r
sudo apt autoremove
```
<p dir="rtl" align="right">درخط فرمان دستور زیر را اجرا کنید، این دستور بررسی می کند که آیا نیاز به راه اندازی مجدد است یا خیر و مطابق با آن عمل می کند.</p>
```r
[ -f /var/run/reboot-required ] && sudo reboot -f
```
<p dir="rtl" align="right">جزئیات انتشار سیستم عامل را می توان با استفاده از دستورات داده شده در اینجا بررسی کرد.</p>
```r
cat /etc/os-release
```
<p dir="rtl" align="right">خروجی دستور بالا:</p>
<p style="background-color: rgb(50, 50, 50); color:white"-->
PRETTY_NAME="Ubuntu 22.04.1 LTS"<br>
NAME="Ubuntu"<br>
VERSION_ID="22.04"<br>
VERSION="22.04.1 LTS (Jammy Jellyfish)"<br>
VERSION_CODENAME=jammy<br>
ID=ubuntu<br>
ID_LIKE=debian<br>
HOME_URL="https://www.ubuntu.com/"<br>
SUPPORT_URL="https://help.ubuntu.com/"<br>
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"<br>
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"<br>
UBUNTU_CODENAME=jammy<br>
</p>
## <p dir="rtl" align="right"> گام دوم: مخزن Surý PHP APT را اضافه کنید </p> ##
<p dir="rtl" align="right">برای نصب بسته های PHP 8.2 روی اوبونتو از Ondřej Surýs PHP PPA استفاده کنید که آخرین نسخه های پایدار PHP را برای سیستم های اوبونتو و Debian است. </p>
<p dir="rtl" align="right"> * برای اوبونتو 18.04 این مخزن حاوی بسته های PHP 8.2 نیست. راهنمای ما در مورد ساختن از منبع را از پیوند زیر بررسی کنید </p>
[Build and Install PHP 8,7 on Ubuntu 18.04 (Bionic Beaver)](https://computingforgeeks.com/install-php-8-7-on-ubuntu-18-bionic-beaver/)
<p dir="rtl" align="right">قبل از افزودن مخزن، چند بسته وابسته را نصب کنید. </p>
```r
sudo apt update
sudo apt install -y lsb-release gnupg2 ca-certificates apt-transport-https software-properties-common
```
<p dir="rtl" align="right">دستورات زیر را در خط فرمان اجرا کنید تا Surý PPA را به سیستم خود اضافه کنید.</p>
```r
sudo add-apt-repository ppa:ondrej/php
```
<p dir="rtl" align="right">اجرای موفقیت آمیز دستور </p>
<p style="background-color: rgb(50, 50, 50); color:white;">
PPA publishes dbgsym, you may need to include 'main/debug' component<br>
Repository: 'deb https://ppa.launchpadcontent.net/ondrej/php/ubuntu/ jammy main'<br>
Description:<br>
Co-installable PHP versions: PHP 5.6, PHP 7.x and most requested extensions are included. Only Supported Versions of PHP (http://php.net/supported-versions.php) for Supported Ubuntu Releases (https://wiki.ubuntu.com/Releases) are provided. Don't ask for end-of-life PHP versions or Ubuntu release, they won't be provided.<br>
<br>
Debian oldstable and stable packages are provided as well: https://deb.sury.org/#debian-dpa<br>
<br>
You can get more information about the packages at https://deb.sury.org<br>
<br>
IMPORTANT: The <foo>-backports is now required on older Ubuntu releases.<br>
<br>
BUGS&FEATURES: This PPA now has a issue tracker:<br>
https://deb.sury.org/#bug-reporting<br>
<br>
CAVEATS:<br>
1. If you are using php-gearman, you need to add ppa:ondrej/pkg-gearman<br>
2. If you are using apache2, you are advised to add ppa:ondrej/apache2<br>
3. If you are using nginx, you are advised to add ppa:ondrej/nginx-mainline<br>
or ppa:ondrej/nginx<br>
<br>
PLEASE READ: If you like my work and want to give me a little motivation, please consider donating regularly: https://donate.sury.<br>org/<br>
<br>
WARNING: add-apt-repository is broken with non-UTF-8 locales, see<br>
https://github.com/oerdnj/deb.sury.org/issues/56 for workaround:<br>
<br>
# LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php<br>
More info: https://launchpad.net/~ondrej/+archive/ubuntu/php<br>
Adding repository.<br>
Press [ENTER] to continue or Ctrl-c to cancel.<br>
Adding deb entry to /etc/apt/sources.list.d/ondrej-ubuntu-php-jammy.list<br>
Adding disabled deb-src entry to /etc/apt/sources.list.d/ondrej-ubuntu-php-jammy.list<br>
Adding key to /etc/apt/trusted.gpg.d/ondrej-ubuntu-php.gpg with fingerprint 14AA40EC0831756756D7F66C4F4EA0AAE5267A6C<br>
Hit:1 https://mirror.hetzner.com/ubuntu/packages jammy InRelease<br>
Hit:2 https://mirror.hetzner.com/ubuntu/packages jammy-updates InRelease<br>
Hit:3 https://mirror.hetzner.com/ubuntu/packages jammy-backports InRelease<br>
Hit:4 https://mirror.hetzner.com/ubuntu/security jammy-security InRelease<br>
Get:5 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy InRelease [23.9 kB]<br>
Get:6 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 Packages [108 kB]<br>
Get:7 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main Translation-en [33.3 kB]<br>
Fetched 166 kB in 1s (120 kB/s)<br>
Reading package lists... Done<br>
</p>
<p dir="rtl" align="right">با اجرای دستور زیر می توانید به صورت دستی تأیید کنید که مخزن کار می کند.</p>
```r
sudo apt update
```
<p dir="rtl" align="right">خروجی دستور بالا:</p>
<p style="background-color: rgb(50, 50, 50); color:white;">
Hit:1 https://mirror.hetzner.com/ubuntu/packages jammy InRelease<br>
Hit:2 https://mirror.hetzner.com/ubuntu/packages jammy-updates InRelease<br>
Hit:3 https://mirror.hetzner.com/ubuntu/packages jammy-backports InRelease<br>
Hit:4 https://mirror.hetzner.com/ubuntu/security jammy-security InRelease<br>
Hit:5 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy InRelease<br>
Reading package lists... Done<br>
Building dependency tree... Done<br>
Reading state information... Done<br>
</p>
## <p dir="rtl" align="right"> گام سوم: نصب PHP 8.2 روی Ubuntu </p> ##
<p dir="rtl" align="right">هنگامی که PPA اضافه شد، از دستور apt برای نصب PHP 8.2 و سایر ماژول های PHP مرتبط روی سرور اوبونتو استفاده کنید.</p>
```r
sudo apt install php8.2
```
<p dir="rtl" align="right">خروجی دستور بالا:</p>
<p style="background-color: rgb(50, 50, 50); color:white;">
The following additional packages will be installed:<br>
apache2 apache2-bin apache2-data apache2-utils bzip2 file libapache2-mod-php8.2 libapr1 libaprutil1 libaprutil1-dbd-sqlite3<br> libaprutil1-ldap liblua5.3-0 mailcap mime-support php-common<br>
php8.2-cli php8.2-common php8.2-opcache php8.2-readline ssl-cert<br>
Suggested packages:<br>
apache2-doc apache2-suexec-pristine | apache2-suexec-custom www-browser bzip2-doc php-pear<br>
The following NEW packages will be installed:<br>
apache2 apache2-bin apache2-data apache2-utils bzip2 file libapache2-mod-php8.2 libapr1 libaprutil1 libaprutil1-dbd-sqlite3<br> libaprutil1-ldap liblua5.3-0 mailcap mime-support php-common php8.2<br>
php8.2-cli php8.2-common php8.2-opcache php8.2-readline ssl-cert<br>
0 upgraded, 21 newly installed, 0 to remove and 2 not upgraded.<br>
Need to get 6,990 kB of archives.<br>
After this operation, 29.8 MB of additional disk space will be used.<br>
Do you want to continue? [Y/n] y<br>
</p>
<p dir="rtl" align="right">نصب بسته را طبق درخواست با کلید Y بپذیرید.</p>
<p dir="rtl" align="right">برای بررسی نسخه PHP که در حال حاضر روی سیستم نصب شده است دستور زیر را اجرا کنید:</p>
```r
php -v
```
<p dir="rtl" align="right">یا دستور:</p>
```r
php --version
```
<p dir="rtl" align="right">خروجی:</p>
<p style="background-color: rgb(50, 50, 50); color:white;">
PHP 8.2.7 (cli) (built: Jun 8 2023 15:27:40) (NTS) <br>
Copyright (c) The PHP Group<br>
Zend Engine v4.2.7, Copyright (c) Zend Technologies<br>
with Zend OPcache v8.2.7, Copyright (c), by Zend Technologies<br>
</p>
## <p dir="rtl" align="right"> گام چهارم: نصب ماژولهای PHP 8.2 </p> ##
<p dir="rtl" align="right">ماژول های PHP کتابخانه های نرم افزاری هستند که برای افزودن قابلیت به PHP ایجاد شده اند. این ماژولها معمولاً به زبان C نوشته می شوند و می توانید به صورت پویا در PHP بارگذاری کنید یا به عنوان اشیاء مشترک کامپایل کنید.
<br>
اگر می‌خواهید ماژول‌های PHP 8.2 را روی سیستم اوبونتو نصب کنید، از apt package manager با دستور داده شده در اینجا استفاده کنید:
</p>
```r
sudo apt install -y php8.2-<module-name>
```
<p dir="rtl" align="right">جایی که <module-name> با نام واقعی ماژولی که قرار است نصب شود جایگزین می شود.</p>
<p dir="rtl" align="right">در این مثال ما ماژول PHP 8.2 fpm را از PPA که قبلا اضافه شده بود نصب می کنیم.</p>
```r
sudo apt install php8.2-fpm
```
<p dir="rtl" align="right">خروجی دستور بالا:</p>
<p style="background-color: rgb(50, 50, 50); color:white;">
Reading package lists... Done<br>
Building dependency tree... Done<br>
Reading state information... Done<br>
Suggested packages:<br>
php-pear<br>
The following NEW packages will be installed:<br>
php8.2-fpm<br>
0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.<br>
Need to get 1,886 kB of archives.<br>
After this operation, 5,756 kB of additional disk space will be used.
Get:1 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 php8.2-fpm amd64 8.2.1-2+ubuntu22.04.1+deb.sury.org+1<br> [1,886 kB]<br>
Fetched 1,886 kB in 0s (5,211 kB/s)<br>
Selecting previously unselected package php8.2-fpm.<br>
(Reading database ... 56412 files and directories currently installed.)<br>
Preparing to unpack .../php8.2-fpm_8.2.1-2+ubuntu22.04.1+deb.sury.org+1_amd64.deb ...<br>
Unpacking php8.2-fpm (8.2.1-2+ubuntu22.04.1+deb.sury.org+1) ...<br>
Setting up php8.2-fpm (8.2.1-2+ubuntu22.04.1+deb.sury.org+1) ...<br>
....<br>
<p dir="rtl" align="right">:نصب ماژول های پرکاربرد</p>
```r
sudo apt install php8.2-{bcmath,fpm,xml,mysql,zip,intl,ldap,gd,cli,bz2,curl,mbstring,pgsql,opcache,soap,cgi}
```
<p dir="rtl" align="right">:ماژول های نصب شده را می توان با دستور زیر فهرست کرد</p>
```r
php -m
```
<p dir="rtl" align="right">خروجی:</p>
<p style="background-color: rgb(50, 50, 50); color:white"-->
[PHP Modules]<br>
bcmath<br>
bz2<br>
calendar<br>
Core<br>
ctype<br>
curl<br>
date<br>
dom<br>
exif<br>
FFI<br>
fileinfo<br>
filter<br>
ftp<br>
gd<br>
gettext<br>
hash<br>
iconv<br>
intl<br>
json<br>
ldap<br>
libxml<br>
mbstring<br>
mysqli<br>
mysqlnd<br>
openssl<br>
pcntl<br>
pcre<br>
PDO<br>
pdo_mysql<br>
pdo_pgsql<br>
pgsql<br>
Phar<br>
posix<br>
readline<br>
Reflection<br>
session<br>
shmop<br>
SimpleXML<br>
soap<br>
sockets<br>
sodium<br>
SPL<br>
standard<br>
sysvmsg<br>
sysvsem<br>
sysvshm<br>
tokenizer<br>
xml<br>
xmlreader<br>
xmlwriter<br>
xsl<br>
Zend OPcache<br>
zip<br>
zlib<br>
<br>
[Zend Modules]<br>
Zend OPcache<br>
</p>
## <p dir="rtl" align="right"> گام پنجم: استفاده از PHP با Nginx / Apache</p> ##
<p dir="rtl" align="right">ما هر دو پیکربندی وب سرور انجینکس و آپاچی را برای میزبانی برنامه پی-اچ-پی شما در نظر خواهیم گرفت.</p>
### <p dir="rtl" align="right"> میزبانی برنامه PHP با وب سرور Nginx</p> ###
<p dir="rtl" align="right">با Nginx، کد PHP معمولاً توسط یک فرآیند جداگانه مانند PHP-FPM (مدیر فرآیند FastCGI) اجرا می شود. PHP-FPM دیمونی است که به درخواست های دریافتی PHP گوش می دهد و آنها را در یک فرآیند جداگانه اجرا می کند. Nginx فقط درخواست های دریافتی را به PHP-FPM ارسال می کند که در آنجا اجرا می شوند.</p>
<p dir="rtl" align="right">وب سرور Nginx و extension FPM را نصب کنید.</p>
```r
sudo apt install nginx php8.2-fpm
```
<p dir="rtl" align="right">پیکربندی سرور Nginx خود را باز کنید و بلوک زیر را داخل بلوک http اضافه کنید تا درخواست‌های PHP را برای اجرا توسط PHP-FPM پیکربندی کنید:</p>
```r
sudo nano /etc/nginx/nginx.conf
```
<p dir="rtl" align="right">در فایل باز شده متن زیر را قرار دهید</p>
```r
server {
listen 80;
server_name mysite.example.com;
root /var/www/mysite;
index index.php index.html;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
}
}
```
<p dir="rtl" align="right">برای ذخیره ی فایل کلید ترکیبی ctrl+ O را بزنید. </p>
<p dir="rtl" align="right">برای خروج از فایل و برگشتن به خط فرمان کلید ترکیبی ctrl + X را بزنید. </p>
<b>
<p dir="rtl" align="right">اعتبار سنجی پیکربندی انجینکس با دستور زیر انجام می گیرد:</p>
```r
sudo nginx -t
```
<p dir="rtl" align="right">خروجی دستور فوق:</p>
<p style="background-color: rgb(50, 50, 50); color:white"-->
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok <br>
nginx: configuration file /etc/nginx/nginx.conf test is successful
</p>
<p dir="rtl" align="right">نشان دهنده درستی پیکربندی است. "ok" , "successful"</p>
### <p dir="rtl" align="right">میزبانی برنامه پی-اچ-پی با وب سرور آپاچی</p> ###
## <p dir="rtl" align="right"> در آپاچی می توانیم از یک ماژول داخلی به نام mod_php برای پردازش کدهای PHP به طور مستقیم در فرآیند آپاچی استفاده کنیم. </p> ##
<p dir="rtl" align="right">اما ابتدا باید بسته وب سرور آپاچی، PHP و پسوند Apache PHP را نصب کنید:</p>
```r
sudo apt install apache2 libapache2-mod-php8.2
```
<p dir="rtl" align="right">اگر دستور فوق جواب نداد به جای آن دستور زیر را اجرا کنید:</p>
```r
sudo apt install apache2 php8.2-fpm
```
<p dir="rtl" align="right">ماژول mod_php فعالسازی:</p>
```r
sudo a2enmod php8.2
```
<p dir="rtl" align="right">برای نمایش آزمایشی </p>
<p dir="rtl" align="right">خط فرمان را باز کنید و دستورات زیر را اجرا کنید:.</p>
```r
cd /var/www/
/var/www$ ls
```
<p style="background-color:black;color:white">
خروجی:<br>
html
</p>
<p dir="rtl" align="right"> اگر پوشه ی html وجود نداشت با دستور زیر این پوشه را ایجاد کنید:</p>
```r
sudo mkdir html
```
<p dir="rtl" align="right"> سپس فایل آزمایشی را ایجاد کنید:</p>
```r
cd html/
sudo nano testPHP.php
```
<p dir="rtl" align="right">در فایل باز شده متن زیر را قرار دهید</p>
```r
<?php
phpinfo();
?>
```
<p dir="rtl" align="right"> با کلید ترکیبی Ctrl+O تغییرات را ذخیره کنید و با کلید ترکیبی Ctrl+X از فایل خارج شوید.</p>
<p dir="rtl" align="right">بعد از پیکربندی سرویس آپاچی را دوباره راه اندازی کنید:</p>
```r
sudo systemctl restart apache2
```
<p dir="rtl" align="right">از URL صفحه وب بازدید کنید:</p>
```r
http://localhost/testPHP.php
```
## <p dir="rtl" align="right"> [منبع:](https://computingforgeeks.com/how-to-install-php-8-2-on-ubuntu/) </p> ##
<p dir="rtl" align="center">صلوات</p>

View File

@ -0,0 +1,16 @@
# Ubuntu change hostname command #
## The procedure to change the computer name on Ubuntu Linux: ##
### * Type the following command to edit /etc/hostname using nano or vi text editor: ###
<code>sudo nano /etc/hostname</code>
### * Delete the old name and setup new name. ###
### * Next Edit the /etc/hosts file: ###
<code>sudo nano /etc/hosts</code>
Replace any occurrence of the existing computer name with your new one.
### *Reboot the system to changes take effect: ###
<code>sudo reboot</code>

View File

@ -0,0 +1,41 @@
# --------------------------بسم الله الرحمن الرحیم -------------------------- #
# Set Permissions Of Files and Folders #
## Below gives all permissions to everybody to all files and subdirectories:##
$ sudo chmod -R a+rwx path
> path like: /home/www/
* for example folder home ...
## write mode : ##
$ sudo chmod 0777 path
## read mode : ##
$ sudo chmod 0750 path
* The surprising permissions that are diagnosed by this mode are:
>
111 => --xr-xrwx
400 => rw--w----
440 => rw-rwx---
444 => rw-rwxr--
551 => ---r--rwt
600 => --x-wx--T
640 => -w------T
644 => -w----r-T
660 => -w--w-r-T
664 => -w--wx--T
666 => -w--wx-wT
700 => -w-rwxr-T
711 => -wx---rwt
750 => -wxr-xrwT
751 => -wxr-xrwt
751 => -wxr-xrwt
755 => -wxrw--wt
770 => r------wT
771 => r------wt
775 => r-----rwt
777 => r----x--t
Of these, only 400 is remotely plausible.

View File

@ -0,0 +1,24 @@
# How to Install Ubuntu on VMware #
Firstly, you need to enable virtualization from BIOS and download VMware and the Ubuntu ISO file on your system. Finally, you'd create a VMware virtual machine and install Ubuntu inside the VM.
## Step 1: Enable Virtualization Using BIOS##
To enable virtualization on your system, follow the given steps:
Restart your system. Press the designated Fn-key or Esc key to enter the BIOS setup.
Navigate to the Advanced Settings page and locate the Virtualization option. It may appear as SVM, Intel VT-x, Intel Virtualization Technology, or AMD-V.
Enable the feature and press F10 to save changes and exit.
Your system will restart and then boot to the desktop. Launch Task Manager and switch to the Performance tab. Now, it will show the Virtualization feature as enabled.
## Step 2: Download VMware and the Ubuntu ISO File##
* Download VMware and the Ubuntu ISO from the respective websites.
Download: VMware Workstation Player
Download: Ubuntu
Navigate to the Downloads folder and install VMware with administrator privileges. Launch the app to check if it runs without any issues.
## Step 3: Create a Linux Virtual Machine##
Launch VMware Workstation Player on your system. Click on the Create a New Virtual Machine option present on the home page.

1
Learning_Our_Project Submodule

@ -0,0 +1 @@
Subproject commit 1ec15599c57101e0c3203140bf81b5a91fa1217b

102
test/testcss.md Normal file
View File

@ -0,0 +1,102 @@
<pre style="max-height: 100px;">
### Header
<div align="center">...body...text...</div>
<div align="center">...body...text...</div>
<div align="center">...body...text...</div>
<div align="center">...body...text...</div>
<div align="center">...body...text...</div>
<div align="center">...body...text...</div>
<div align="center">...body...text...</div>
</pre>
<pre style="max-height: 100px;">
<code>## [1] 1 2 3 4 5 6 7 8 9 10
## [11] 11 12 13 14 15 16 17 18 19 20
## ... ...</code>
</pre>
```{r, include=FALSE}
options(width = 60)
local({
hook_output <- knitr::knit_hooks$get('output')
knitr::knit_hooks$set(output = function(x, options) {
if (!is.null(options$max.height)) options$attr.output <- c(
options$attr.output,
sprintf('style="max-height: %s;"', options$max.height)
)
hook_output(x, options)
})
})
```
# Heading 1
Regular text.
**Bold text.** *Italic text.* ***Both: bold and italic.***
A line (horizontal ruler) using underscores:
___
<s>Strike through</s> NB. using `~~deleted text~~` doesn't work in Freeplane (Java html/css renderer)
E.g. ~~deleted text~~
<u>Underlined text</u>
## Heading 2
> A quote, line 1.
> Line 2 of the quote (will be joined with line 1).
>> A quote within a quote
### Heading 3
Sample text with `an in-line piece of code`.
```groovy
// a Groovy code example - as a block of code
def name = 'Freeplane User'
"Hello, ${name}!"
"Hello2, ${name2}!"
```
Another example of a block of code
introduced as indented Markdown (with a tab or 4 spaces)
> An example of a quote
> containing a block of code
> At least 5 spaces need to be used
> And it continues as a regular quote
#### Heading 4
A table
| # | Language | [Pangram](https://en.wikipedia.org/wiki/Pangram) |
|--|--|--|
| 1 | English | The quick brown fox jumps over the lazy dog |
| 2 | French | Portez ce vieux whisky au juge blond qui fume |
| 3 | German | Victor jagt zwölf Boxkämpfer quer über den großen Sylter Deich |
| 4 | Italian | Pranzo d'acqua fa volti sghembi |
| 5 | Spanish | Benjamín pidió una bebida de kiwi y fresa. Noé, sin vergüenza, la más exquisita champaña del menú |
##### Heading 5
A list of items
* Item 1
* Item 2
* Item 3
###### Heading 6
A numbered list
1. Item A
2. Item B
3. Item C

45
test/testscroll.md Normal file
View File

@ -0,0 +1,45 @@
---
title: Scrollable code blocks
input : markdown
output: html_document
---
```{css, echo=FALSE}
pre {
max-height: 300px;
overflow-y: auto;
}
pre[class] {
max-height: 100px;
}
```
We have defined some CSS rules to limit the height of
code blocks. Now we can test if these rules work on code
blocks and text output:
```{r}
# pretend that we have a lot of code in this chunk
if (1 + 1 == 2) {
# of course that is true
print(mtcars)
# we just printed a lengthy data set
}
```
Next we add rules for a new class `scroll-100` to limit
the height to 100px, and add the class to the output of
a code chunk via the chunk option `class.output`:
```{css, echo=FALSE}
.scroll-100 {
max-height: 100px;
overflow-y: auto;
background-color: inherit;
}
```
```{r, class.output="scroll-100"}
print(mtcars)
```