Difference between revisions of "Debian"

From Server Knowledge Base
Jump to navigationJump to search
 
(30 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Broken package ==
initscripts : Breaks: nfs-common (< 1:1.2.5-3) but 1:1.2.2-4squeeze2 is to be installed
If you're on Debian 6 (squeeze) do:
vim /etc/apt/sources.list
Make sure there are no lines like the one below:
deb http://ftp.uk.debian.org/debian sid main
== Check OS version ==
cat /etc/issue
or
<pre>uname -r</pre>
== Cron log ==
<pre>cat /var/log/syslog | grep CRON</pre>
== How to send mail to Gmail ==
If you are on Debian 7 as of 16/09/2013 I would advise doing the following:
<pre>vim /etc/apt/sources.list</pre>
Add the following line:
<pre>deb http://ftp.uk.debian.org/debian wheezy main contrib</pre>
Then do:
<pre>apt-get update</pre>
Then follow this guide: http://www.cyberciti.biz/tips/linux-use-gmail-as-a-smarthost.html
Afterwards comment out the new /etc/apt/sources.list line and do apt-get update again.
== monit ==
<pre>apt-get install monit
vim /etc/default/monit</pre>
Set startup=0 to startup=1
The config file is /etc/monit/monitrc
<pre>set httpd port 2812
    use address 12.34.56.789  # only accept connection from localhost
    allow 0.0.0.0/0.0.0.0        # allow localhost to connect to the server and
    allow admin:password        # require user 'admin' with password 'password'</pre>
https://www.digitalocean.com/community/articles/how-to-install-and-configure-monit<br>
http://viktorpetersson.com/2010/07/09/setting-up-monit-to-monitor-apache-and-postgresql-on-ubuntu
== motd ==
http://wiki.debian.org/motd
== mutt ==
http://solver.io/wp/2012/10/06/e-could-not-perform-immediate-configuration-on-exim4-daemon-light-please-see-man-5-apt-conf-under-aptimmediate-configure-for-details-2<br>
http://ubuntuforums.org/showthread.php?t=1672227<br>
http://techteam.wordpress.com/2009/05/13/how-to-attach-large-files-to-command-line-email/
If you use mutt to send emails via scripts and get this message because the attachment is too large:
<pre>postdrop: warning: uid=0: File too large
sendmail: fatal: root(0): message file too big
Error sending message, child exited 75 (Deferred.).
Could not send the message.</pre>
DO NOT install exim ('''especially if you have Proxmox installed''') to try and solve the issue as it will do the following:
<pre>apt-get install exim4</pre>
<pre>Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  exim4-base exim4-config exim4-daemon-light
Suggested packages:
  eximon4 exim4-doc-html exim4-doc-info spf-tools-perl swaks
The following packages will be REMOVED:
  postfix
The following NEW packages will be installed:
  exim4 exim4-base exim4-config exim4-daemon-light
0 upgraded, 4 newly installed, 1 to remove and 31 not upgraded.
Need to get 2,080 kB of archives.
After this operation, 807 kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get:1 http://ftp.uk.debian.org/debian/ squeeze/main exim4-base amd64 4.72-6+squeeze3 [1,016 kB]
Get:2 http://ftp.uk.debian.org/debian/ squeeze/main exim4-daemon-light amd64 4.72-6+squeeze3 [594 kB]
Get:3 http://ftp.uk.debian.org/debian/ squeeze/main exim4-config all 4.72-6+squeeze3 [462 kB]
Get:4 http://ftp.uk.debian.org/debian/ squeeze/main exim4 all 4.72-6+squeeze3 [7,812 B]
Fetched 2,080 kB in 0s (7,680 kB/s)
E: Could not perform immediate configuration on 'exim4-daemon-light'. Please see man 5 apt.conf under APT::Immediate-Configure for details. (2)</pre>
<pre>apt-get install exim4-base exim4-config</pre>
Reading package lists... Done<br>
Building dependency tree<br>
Reading state information... Done<br>
The following package was automatically installed and is no longer required:<br>
'''pve-kernel-2.6.32-19-pve'''<br>
Use 'apt-get autoremove' to remove them.<br>
The following extra packages will be installed:<br>
pve-kernel-2.6.32-19-pve<br>
Suggested packages:<br>
eximon4 exim4-doc-html exim4-doc-info spf-tools-perl swaks<br>
The following packages will be REMOVED:<br>
bsd-mailx postfix proxmox-ve-2.6.32 pve-manager<br>
The following NEW packages will be installed:<br>
exim4-base exim4-config pve-kernel-2.6.32-19-pve<br>
0 upgraded, 3 newly installed, 4 to remove and 30 not upgraded.<br>
Need to get 31.9 MB/33.4 MB of archives.<br>
After this operation, 553 kB disk space will be freed.<br>
Do you want to continue [Y/n]? Y<br>
Get:1 http://download.proxmox.com/debian/ squeeze/pve pve-kernel-2.6.32-19-pve amd64 2.6.32-96 [31.9 MB]<br>
Fetched 31.9 MB in 3s (8,937 kB/s)<br>
Preconfiguring packages ...<br>
(Reading database ... 56486 files and directories currently installed.)<br>
Removing bsd-mailx ...<br>
'''Removing proxmox-ve-2.6.32''' ...<br>
'''Removing pve-manager''' ...<br>
'''Removing postfix''' ...<br>
'''Stopping Postfix Mail Transport Agent: postfix.'''<br>
Processing triggers for man-db ...<br>
Selecting previously deselected package exim4-config.<br>
(Reading database ... 55756 files and directories currently installed.)<br>
Unpacking exim4-config (from .../exim4-config_4.72-6+squeeze3_all.deb) ...<br>
Selecting previously deselected package exim4-base.<br>
Unpacking exim4-base (from .../exim4-base_4.72-6+squeeze3_amd64.deb) ...<br>
Selecting previously deselected package pve-kernel-2.6.32-19-pve.<br>
Unpacking pve-kernel-2.6.32-19-pve (from .../pve-kernel-2.6.32-19-pve_2.6.32-96_amd64.deb) ...<br>
Processing triggers for man-db ...<br>
Setting up exim4-config (4.72-6+squeeze3) ...<br>
grep: /etc/inetd.conf: No such file or directory<br>
Adding system-user for exim (v4)<br>
Setting up exim4-base (4.72-6+squeeze3) ...<br>
insserv: warning: script 'K01jira' missing LSB tags and overrides<br>
insserv: warning: script 'jira' missing LSB tags and overrides<br>
Setting up pve-kernel-2.6.32-19-pve (2.6.32-96) ...<br>
update-initramfs: Generating /boot/initrd.img-2.6.32-19-pve<br>
Generating grub.cfg ...<br>
Found linux image: /boot/vmlinuz-2.6.32-19-pve<br>
Found initrd image: /boot/initrd.img-2.6.32-19-pve<br>
Found linux image: /boot/vmlinuz-2.6.32-18-pve<br>
Found initrd image: /boot/initrd.img-2.6.32-18-pve<br>
Found memtest86+ image: /memtest86+.bin<br>
Found memtest86+ multiboot image: /memtest86+_multiboot.bin<br>
done<br>
<pre>apt-get install exim4-daemon-light</pre>
<pre>Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
  pve-kernel-2.6.32-19-pve
Use 'apt-get autoremove' to remove them.
The following NEW packages will be installed:
  exim4-daemon-light
0 upgraded, 1 newly installed, 0 to remove and 30 not upgraded.
Need to get 0 B/594 kB of archives.
After this operation, 1,135 kB of additional disk space will be used.
Preconfiguring packages ...
Selecting previously deselected package exim4-daemon-light.
(Reading database ... 58349 files and directories currently installed.)
Unpacking exim4-daemon-light (from .../exim4-daemon-light_4.72-6+squeeze3_amd64.deb) ...
Processing triggers for man-db ...
Setting up exim4-daemon-light (4.72-6+squeeze3) ...
Starting MTA: exim4.</pre>
If you start getting the following message:
mailx Can't send mail: sendmail process failed with error code 67
And you can't start Apache, you need to re-install pve-manager.
=== error code 67 ===
If you get this error message when sending mail to a domain with mail externally but it is on the server:
Can't send mail: sendmail process failed with error code 67
Add the domain to this file and restart sendmail:
<pre>vim /etc/mail/relay-domains
/etc/init.d/sendmail restart</pre>
== MySQL ==
== MySQL ==


Line 5: Line 200:
<pre>mysqldump --default-character-set=binary --user=root --password=EnterPasswordHere databasename > dbdump.txt</pre>
<pre>mysqldump --default-character-set=binary --user=root --password=EnterPasswordHere databasename > dbdump.txt</pre>
<pre>mysql --silent --local --password=EnterPasswordHere DatabaseName < dbdump.txt</pre>
<pre>mysql --silent --local --password=EnterPasswordHere DatabaseName < dbdump.txt</pre>
== ReadyNAS ==
===  Deleting large file/s fails and crashes NAS ===
https://community.netgear.com/t5/Using-your-ReadyNAS-in-Business/Deleting-large-file-fails-and-crashes-NAS/m-p/1562763?collapse_discussion=true&search_type=thread
Use truncate
=== Install mplayer on Debian Wheezy ===
Add the following lines to your /etc/apt/sources.list file:
<pre># Debian Multimedia Repository
deb http://www.deb-multimedia.org wheezy main non-free
deb ftp://ftp.deb-multimedia.org wheezy main non-free</pre>
Then do:
<pre>apt-get update
apt-get install deb-multimedia-keyring
apt-get update
apt-get install libimage-exiftool-perl ffmpeg
apt-get install mplayer mencoder</pre>
Then comment out the following lines to your /etc/apt/sources.list file:
<pre># Debian Multimedia Repository
#deb http://www.deb-multimedia.org wheezy main non-free
#deb ftp://ftp.deb-multimedia.org wheezy main non-free</pre>
And run apt-get update again.
This can be needed to also get mencoder working as well.
mediainfo and dcraw should install normally without the above packages.
vlc and vlc-nox will ask to remove some of the packages that were installed above.
=== ReadyCloud page not working for ReadyNAS on Static IP ===
<pre>netstat -na |grep LISTEN |grep ':80\|:443'
cat /etc/apache2/ports.conf
ps aux |grep apache
ls -l /frontview/dashboard
cat nonadmin_redirect.html
free -h
cat /proc/meminfo
locate error.log
tail -f /var/log/apache2/error.log
tail -f /var/log/frontview/error.log
date
tail -f /var/log/frontview/http-error.log
hostname
top
systemctl status readynasd
service ctscand stop
ps -ef | grep ctsc
systemctl status apache2
systemctl restart apache2
systemctl status apache2
ps -ef | grep readynasd
systemctl status readynasd
cat /etc/default/services | grep "FRONTVIEWLOCALE"
btrfs fi show
btrfs fi df /data
df -h
df -i
cat /var/log/frontview/initrd.log</pre>
apt-get update fails due to static IP + DNS
== Set date/time ==
<pre>dpkg-reconfigure tzdata</pre>
http://en.wikipedia.org/wiki/Tz_database
Or you can just install NTP (Network Time Protocol) using:
<pre>apt-get install ntp</pre>
== Speed up SSH login ==
By default for some reason in Debian 6 (Squeeze) /etc/ssh/sshd_config does not have UseDNS=no within it. Add it into the file and restart SSH and this will greatly improve SSH login as a sudo user or root. GSSAPIAuthentication=no may also help.


== Transmission ==
== Transmission ==
Config File configuration: https://trac.transmissionbt.com/wiki/EditConfigFiles
Pre-installation:
<pre>apt-get install vim ncdu</pre>


The easiest way to get this working is by doing:
The easiest way to get this working is by doing:
Line 34: Line 320:


Check /etc/transmission-daemon/settings.json is the same file you edited and that it is owned by debian-transmission:debian-transmission
Check /etc/transmission-daemon/settings.json is the same file you edited and that it is owned by debian-transmission:debian-transmission
== User has the wrong group ==
For example you want the files of the User tester to have the following User:Group setting:
<pre>tester:tester</pre>
However the system is creating files as tester:anotherGroupOrUser
To resolve this log in as root and do:
<pre>usermod -g tester tester</pre>
This will set the tester User's primary group as tester.
== Wordpress ==
If you are using a Vanilla build of a Unix OS you will need to do this so themes and plugins can install:
cd /var/www/vhosts/<br>
chown www-data:www-data yourdomain.co.uk/* -R
=== Stop prompting for FTP credentials ===
echo "" >> /var/www/vhosts/yourdomain.co.uk/wp-config.php<br>
echo "define('FS_METHOD', 'direct');" >> /var/www/vhosts/yourdomain.co.uk/wp-config.php

Latest revision as of 16:24, 5 June 2019

Broken package

initscripts : Breaks: nfs-common (< 1:1.2.5-3) but 1:1.2.2-4squeeze2 is to be installed

If you're on Debian 6 (squeeze) do:

vim /etc/apt/sources.list

Make sure there are no lines like the one below:

deb http://ftp.uk.debian.org/debian sid main

Check OS version

cat /etc/issue

or

uname -r

Cron log

cat /var/log/syslog | grep CRON

How to send mail to Gmail

If you are on Debian 7 as of 16/09/2013 I would advise doing the following:

vim /etc/apt/sources.list

Add the following line:

deb http://ftp.uk.debian.org/debian wheezy main contrib

Then do:

apt-get update

Then follow this guide: http://www.cyberciti.biz/tips/linux-use-gmail-as-a-smarthost.html

Afterwards comment out the new /etc/apt/sources.list line and do apt-get update again.

monit

apt-get install monit
vim /etc/default/monit

Set startup=0 to startup=1

The config file is /etc/monit/monitrc

set httpd port 2812
    use address 12.34.56.789  # only accept connection from localhost
    allow 0.0.0.0/0.0.0.0        # allow localhost to connect to the server and
    allow admin:password         # require user 'admin' with password 'password'

https://www.digitalocean.com/community/articles/how-to-install-and-configure-monit
http://viktorpetersson.com/2010/07/09/setting-up-monit-to-monitor-apache-and-postgresql-on-ubuntu

motd

http://wiki.debian.org/motd

mutt

http://solver.io/wp/2012/10/06/e-could-not-perform-immediate-configuration-on-exim4-daemon-light-please-see-man-5-apt-conf-under-aptimmediate-configure-for-details-2
http://ubuntuforums.org/showthread.php?t=1672227
http://techteam.wordpress.com/2009/05/13/how-to-attach-large-files-to-command-line-email/

If you use mutt to send emails via scripts and get this message because the attachment is too large:

postdrop: warning: uid=0: File too large
sendmail: fatal: root(0): message file too big
Error sending message, child exited 75 (Deferred.).
Could not send the message.

DO NOT install exim (especially if you have Proxmox installed) to try and solve the issue as it will do the following:

apt-get install exim4
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  exim4-base exim4-config exim4-daemon-light
Suggested packages:
  eximon4 exim4-doc-html exim4-doc-info spf-tools-perl swaks
The following packages will be REMOVED:
  postfix
The following NEW packages will be installed:
  exim4 exim4-base exim4-config exim4-daemon-light
0 upgraded, 4 newly installed, 1 to remove and 31 not upgraded.
Need to get 2,080 kB of archives.
After this operation, 807 kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get:1 http://ftp.uk.debian.org/debian/ squeeze/main exim4-base amd64 4.72-6+squeeze3 [1,016 kB]
Get:2 http://ftp.uk.debian.org/debian/ squeeze/main exim4-daemon-light amd64 4.72-6+squeeze3 [594 kB]
Get:3 http://ftp.uk.debian.org/debian/ squeeze/main exim4-config all 4.72-6+squeeze3 [462 kB]
Get:4 http://ftp.uk.debian.org/debian/ squeeze/main exim4 all 4.72-6+squeeze3 [7,812 B]
Fetched 2,080 kB in 0s (7,680 kB/s)
E: Could not perform immediate configuration on 'exim4-daemon-light'. Please see man 5 apt.conf under APT::Immediate-Configure for details. (2)
apt-get install exim4-base exim4-config

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
pve-kernel-2.6.32-19-pve
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
pve-kernel-2.6.32-19-pve
Suggested packages:
eximon4 exim4-doc-html exim4-doc-info spf-tools-perl swaks
The following packages will be REMOVED:
bsd-mailx postfix proxmox-ve-2.6.32 pve-manager
The following NEW packages will be installed:
exim4-base exim4-config pve-kernel-2.6.32-19-pve
0 upgraded, 3 newly installed, 4 to remove and 30 not upgraded.
Need to get 31.9 MB/33.4 MB of archives.
After this operation, 553 kB disk space will be freed.
Do you want to continue [Y/n]? Y
Get:1 http://download.proxmox.com/debian/ squeeze/pve pve-kernel-2.6.32-19-pve amd64 2.6.32-96 [31.9 MB]
Fetched 31.9 MB in 3s (8,937 kB/s)
Preconfiguring packages ...
(Reading database ... 56486 files and directories currently installed.)
Removing bsd-mailx ...
Removing proxmox-ve-2.6.32 ...
Removing pve-manager ...
Removing postfix ...
Stopping Postfix Mail Transport Agent: postfix.
Processing triggers for man-db ...
Selecting previously deselected package exim4-config.
(Reading database ... 55756 files and directories currently installed.)
Unpacking exim4-config (from .../exim4-config_4.72-6+squeeze3_all.deb) ...
Selecting previously deselected package exim4-base.
Unpacking exim4-base (from .../exim4-base_4.72-6+squeeze3_amd64.deb) ...
Selecting previously deselected package pve-kernel-2.6.32-19-pve.
Unpacking pve-kernel-2.6.32-19-pve (from .../pve-kernel-2.6.32-19-pve_2.6.32-96_amd64.deb) ...
Processing triggers for man-db ...
Setting up exim4-config (4.72-6+squeeze3) ...
grep: /etc/inetd.conf: No such file or directory
Adding system-user for exim (v4)
Setting up exim4-base (4.72-6+squeeze3) ...
insserv: warning: script 'K01jira' missing LSB tags and overrides
insserv: warning: script 'jira' missing LSB tags and overrides
Setting up pve-kernel-2.6.32-19-pve (2.6.32-96) ...
update-initramfs: Generating /boot/initrd.img-2.6.32-19-pve
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.32-19-pve
Found initrd image: /boot/initrd.img-2.6.32-19-pve
Found linux image: /boot/vmlinuz-2.6.32-18-pve
Found initrd image: /boot/initrd.img-2.6.32-18-pve
Found memtest86+ image: /memtest86+.bin
Found memtest86+ multiboot image: /memtest86+_multiboot.bin
done

apt-get install exim4-daemon-light
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
  pve-kernel-2.6.32-19-pve
Use 'apt-get autoremove' to remove them.
The following NEW packages will be installed:
  exim4-daemon-light
0 upgraded, 1 newly installed, 0 to remove and 30 not upgraded.
Need to get 0 B/594 kB of archives.
After this operation, 1,135 kB of additional disk space will be used.
Preconfiguring packages ...
Selecting previously deselected package exim4-daemon-light.
(Reading database ... 58349 files and directories currently installed.)
Unpacking exim4-daemon-light (from .../exim4-daemon-light_4.72-6+squeeze3_amd64.deb) ...
Processing triggers for man-db ...
Setting up exim4-daemon-light (4.72-6+squeeze3) ...
Starting MTA: exim4.

If you start getting the following message:

mailx Can't send mail: sendmail process failed with error code 67

And you can't start Apache, you need to re-install pve-manager.

error code 67

If you get this error message when sending mail to a domain with mail externally but it is on the server:

Can't send mail: sendmail process failed with error code 67

Add the domain to this file and restart sendmail:

vim /etc/mail/relay-domains
/etc/init.d/sendmail restart

MySQL

It is commonly easier to use this to dump and restore MySQL, instead of using mysqldump on the new server via .sql files:

mysqldump --default-character-set=binary --user=root --password=EnterPasswordHere databasename > dbdump.txt
mysql --silent --local --password=EnterPasswordHere DatabaseName < dbdump.txt

ReadyNAS

Deleting large file/s fails and crashes NAS

https://community.netgear.com/t5/Using-your-ReadyNAS-in-Business/Deleting-large-file-fails-and-crashes-NAS/m-p/1562763?collapse_discussion=true&search_type=thread

Use truncate

Install mplayer on Debian Wheezy

Add the following lines to your /etc/apt/sources.list file:

# Debian Multimedia Repository
deb http://www.deb-multimedia.org wheezy main non-free
deb ftp://ftp.deb-multimedia.org wheezy main non-free

Then do:

apt-get update
apt-get install deb-multimedia-keyring
apt-get update
apt-get install libimage-exiftool-perl ffmpeg
apt-get install mplayer mencoder

Then comment out the following lines to your /etc/apt/sources.list file:

# Debian Multimedia Repository
#deb http://www.deb-multimedia.org wheezy main non-free
#deb ftp://ftp.deb-multimedia.org wheezy main non-free

And run apt-get update again.

This can be needed to also get mencoder working as well.

mediainfo and dcraw should install normally without the above packages.

vlc and vlc-nox will ask to remove some of the packages that were installed above.

ReadyCloud page not working for ReadyNAS on Static IP

netstat -na |grep LISTEN |grep ':80\|:443'
cat /etc/apache2/ports.conf
ps aux |grep apache
ls -l /frontview/dashboard
cat nonadmin_redirect.html
free -h
cat /proc/meminfo
locate error.log
tail -f /var/log/apache2/error.log
tail -f /var/log/frontview/error.log
date
tail -f /var/log/frontview/http-error.log
hostname
top
systemctl status readynasd
service ctscand stop
ps -ef | grep ctsc
systemctl status apache2
systemctl restart apache2
systemctl status apache2
ps -ef | grep readynasd
systemctl status readynasd
cat /etc/default/services | grep "FRONTVIEWLOCALE"
btrfs fi show
btrfs fi df /data
df -h
df -i
cat /var/log/frontview/initrd.log

apt-get update fails due to static IP + DNS

Set date/time

dpkg-reconfigure tzdata

http://en.wikipedia.org/wiki/Tz_database

Or you can just install NTP (Network Time Protocol) using:

apt-get install ntp

Speed up SSH login

By default for some reason in Debian 6 (Squeeze) /etc/ssh/sshd_config does not have UseDNS=no within it. Add it into the file and restart SSH and this will greatly improve SSH login as a sudo user or root. GSSAPIAuthentication=no may also help.

Transmission

Config File configuration: https://trac.transmissionbt.com/wiki/EditConfigFiles

Pre-installation:

apt-get install vim ncdu

The easiest way to get this working is by doing:

vim /etc/apt/sources.list

Add in this line:

deb http://ftp.uk.debian.org/debian sid main

Do apt-get update , then do:

apt-cache show transmission-cli | grep Version
apt-cache show transmission-common | grep Version
apt-cache show transmission-daemon | grep Version
apt-get install transmission-cli transmission-common transmission-daemon

Then, to edit the files without it overwriting /etc/transmission-daemon/settings.json

Stop the service, edit the file, backup the file and then start the service.

/etc/init.d/transmission-daemon stop
vim /etc/transmission-daemon/settings.json
cp /etc/transmission-daemon/settings.json /root/settings.json.backup
/etc/init.d/transmission-daemon start

Check /etc/transmission-daemon/settings.json is the same file you edited and that it is owned by debian-transmission:debian-transmission

User has the wrong group

For example you want the files of the User tester to have the following User:Group setting:

tester:tester

However the system is creating files as tester:anotherGroupOrUser To resolve this log in as root and do:

usermod -g tester tester

This will set the tester User's primary group as tester.

Wordpress

If you are using a Vanilla build of a Unix OS you will need to do this so themes and plugins can install:

cd /var/www/vhosts/
chown www-data:www-data yourdomain.co.uk/* -R

Stop prompting for FTP credentials

echo "" >> /var/www/vhosts/yourdomain.co.uk/wp-config.php
echo "define('FS_METHOD', 'direct');" >> /var/www/vhosts/yourdomain.co.uk/wp-config.php