Difference between revisions of "Debian"

From Server Knowledge Base
Jump to navigationJump to search
Line 196: Line 196:
<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 ==
=== 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 ==
== Set date/time ==

Revision as of 13:25, 22 October 2015

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 uname / version

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

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

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