
در این مقاله قصد داریم که کانفیگ اولیه سرورهای Debian را توضیح دهیم . سیستم عامل رایگان Debian در سال 1993 حدود 22 سال پیش تولید شده است و یکی از بهترین گزینه ها برای Web Server می باشد چون از هسته سیستم عامل های سرور می باشد. . در زمان نوشتن این مقاله آخرین نسخه این سیستم عامل 8.1 می باشد. ما بر روی نسخه 7 این آموزش را انجام داده ایم. اما تفاوتی بین 7و 8 در اجرای دستورات ندارد.
نسخه ای که شما می توانید نصب کنید باید از هسته amd64: x86-64 architecture with 64-bit userland and supporting 32-bit software باشد.
بعد از نصب با استفاده از DVD این سیستم عامل ، و انتخاب یوزر و پسوردها باید تنظمیمات سرور را چک کنید و همچنین تنظیمات اولیه کارت شبکه. که تنظیمات کارت شبکه در ابتدای نصب از شما پرسیده می شود.
اگر سرور پینگ ندارد از طریق دستور زیر وارد قسمت کارت شبکه بشید و IP را چک کنید :
nano /etc/network/interfaces
همچنین دی ان اس ها را هم چک کنید که صحیح باشد :
nani /etc/resolv.conf
باید دی ان اس ها به فرمت زیر وارد بشوند :
nameserver 8.8.8.8 nameserver 8.8.4.4
بعد از این موارد کارت شبکه را ریست کنید با دستور زیر :
/etc/init.d/networking restart
حال باید با یوزر root وارد سرور بشید ، اگر در حالت گرافیکی هستید لطفا از منو Applicatin و گزینه Terminal وارد ترمینال و حالت کامندی سرور بشید.
در این پنجره ترمینال دستور su را بزنید.
با این دستور از شما پسورد روت سرور را می پرسد و بعد از صحیح وارد کردن آن ، شما با یوزر root با سطح دسترسی فول وارد شده اید.
بعضی مواقع موقع اجرای دستورات خطای زیر زده می شود :
Media change: please insert the disc labeled 'Debian GNU/Linux 7.0.0 _Wheezy_ - Official amd64 CD Binary-1 20130504-14:44' in the drive '/media/cdrom/' and press enter
برای اینکه دبیان بتواند موقع آپدیت پکیج ها را به خوبی دریافت کنید شما ابتدا باید CD-ROM را از لیست پکیج های دانلود بردارید و سپس آدرس های زیر ( در صورت عدم وجود) وارد کنید :
nano /etc/apt/sources.list
در لیست می تواتنید CD-rom را با گزینه # غیر فعال کنید و موارد زیر را اضافه کنید :
deb http://ftp.us.debian.org/debian/ wheezy main deb-src http://ftp.us.debian.org/debian/ wheezy main deb http://security.debian.org/ wheezy/updates main deb-src http://security.debian.org/ wheezy/updates main # wheezy-updates, previously known as 'volatile' deb http://ftp.us.debian.org/debian/ wheezy-updates main deb-src http://ftp.us.debian.org/debian/ wheezy-updates main
دبیان برای ابتدای نصب نیاز به اجرای به روز رسانی نیز دارد .با استفاده از دستور زیر :
# apt-get update
ممکن است در موقع نصب بسته با ارور unable to lock directory /var/lib/apt/lists/ debian مواجه بشید ، که برای آن باید از طریق دستورات لینک زیر اقدام کنید :
این ارور به معنی apt یه جای دیگه درگیر هست . شما دستور زیر را اجرا کن و دوباره دستور اپدیت را اجرا کن .
sudo rm /var/lib/apt/lists/lock
حال NTP برای هماهنگی کامل ساعت و تاریخ سرور را نصب کنید با دستور زیر :
apt-get install ntp ntpdate
برای نصب SSH باید دستورات زیر را وارد کنید
Task: Install OpenSSH server Under Debian Linux
Type the following command:# apt-get install openssh-server
Sample outputs:
Reading package lists... Done Building dependency tree Reading state information... Done Suggested packages: ssh-askpass rssh molly-guard ufw The following NEW packages will be installed: openssh-server 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 318 kB of archives. After this operation, 717 kB of additional disk space will be used. Get:1 http://mirror.anl.gov/debian/ squeeze/main openssh-server amd64 1:5.5p1-6+squeeze1 [318 kB] Fetched 318 kB in 3s (89.0 kB/s) Preconfiguring packages ... Selecting previously deselected package openssh-server. (Reading database ... 153448 files and directories currently installed.) Unpacking openssh-server (from .../openssh-server_1%3a5.5p1-6+squeeze1_amd64.deb) ... Processing triggers for man-db ... Setting up openssh-server (1:5.5p1-6+squeeze1) ... Creating SSH2 RSA key; this may take some time ... Creating SSH2 DSA key; this may take some time ... Restarting OpenBSD Secure Shell server: sshd.
By default openssh will run on the TCP port 22.
بدین صورت سرور ما آماده است و می توانید با SSH به سرور وصل بشید.
برای اینکه یوزر ROOT به صورت پیش فرض باشه باید از آموزش زیر کمک بگیرید :
Enable SSH root login on Debian Linux Server
After fresh system installation the root login on the Debian Linux is disabled by default. When you attempt to login as root user to your Debian Jessie Linux server the access will be denied eg.:$ ssh root@10.1.1.12 root@10.1.1.12's password: Permission denied, please try again. root@10.1.1.12's password: Permission denied, please try again. root@10.1.1.12's password: Permission denied (publickey,password).To enable SSH login for a root user on Debian Linux system you need to first configure SSH server. Open
/etc/ssh/sshd_config and change the following line:
FROM: PermitRootLogin without-password TO: PermitRootLogin yesOnce you made the above change restart your SSH server:
# /etc/init.d/ssh restart [ ok ] Restarting ssh (via systemctl): ssh.service.From now on you will be able to ssh login as a root:
$ ssh root@10.1.1.12 root@10.1.1.12's password: The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.