📜 ⬆️ ⬇️

Debian Optimization

Debian is a very good distribution, but not always fast, with instructions on how to speed it up significantly. The system with fluxbox without optimization is loaded in 26 seconds, with optimization in 11!
During the optimization, the system will be transferred to ext4, there will be a new kernel and the packages will be assembled from the source code, as well as init is replaced with upstart

A warning


All actions to produce with a clean system, in the case of a worker, there is a risk to break everything! A netinstall image is recommended for this purpose.
When installing / boot, you need to make a separate partition, enough 200mb and ext2

Core


For these purposes, you need to use the latest kernel (> = 2.6.28) and assemble it manually, how to do it correctly:
make menuconfig
In Processor type and features -> Processor family select your processor (I have a Core 2 / newer Xeon)
In File systems modular The Extended 4 (ext4) filesystem and select Ext4 extended attributes
Finish the configuration, proceed to the assembly:
make-kpkg --initrd --append-to-version="-append" kernel_image kernel_headers
dpkg -i ../linux*.deb

Where append can be replaced by any of his word.
To ensure there are no problems with the modules, it is recommended to connect the sidux repository, for this purpose in /etc/apt/sources.list:
deb debian.tu-bs.de/project/sidux/debian sid main contrib non-free fix.main fix.contrib fix.non-free
deb-src debian.tu-bs.de/project/sidux/debian sid main contrib non-free fix.main fix.contrib fix.non-free


Transfer to ext4


To get started, download partdemagic livecd or liveusb, boot from the disk.
To transfer fs to ext4 (do not translate / boot to ext4!):
tune2fs -O extents,uninit_bg,dir_index /dev/sdXX
fsck -pf /dev/sdXX

Where sdXX is the desired partition, enter fdisk -l to view the list of partitions
For our system to boot you need to do:
mount -a
nano /media/sdYY/etc/fstab

nano, as it is built into the boot disk. sdYY is the root partition.
In the file that opens in sections where ext4 ext3 on ext4 has become
If you translated / to ext4, then to /media/sdYY/boot/grub/menu.lst
We will add rootfstype = ext4 to the kernel line of our kernel and # kopt = to the same line.
Now you can reboot with ext4 with a clear conscience

apt-build


This is a program that allows you to install packages from source codes, enter aptitude install apt-build to install , after installation you will be asked to select your processor, on the Internet you can find additional parameters for your processor, my settings file ( / etc / apt / apt- build.conf ): build-dir = /var/cache/apt-build/build
repository-dir = /var/cache/apt-build/repository
Olevel = -O2
mtune = -mtune=core2
options = "-pipe -fomit-frame-pointer"
make_options = "-j4 "
build-dir = /var/cache/apt-build/build
repository-dir = /var/cache/apt-build/repository
Olevel = -O2
mtune = -mtune=core2
options = "-pipe -fomit-frame-pointer"
make_options = "-j4 "

To begin, rebuild the already installed packages, for this:
dpkg --get-selections | awk '{if ($2 == "install") print $1}' > /etc/apt/apt-build.list
echo "Package: *
Pin: release o=apt-build
Pin-Priority: 990" >> /etc/apt/preference

The latter was done so that when updating the collected packages are not replaced by packages from the repository.
To rebuild everything, enter apt-build world and when it says that for some program there are no source texts, we remove it from /etc/apt/apt-build.list
')
Later packages install via apt-build install , updated via apt-build upgrade , more information in man apt-build

Replacing init with upstart


upstart is faster than init, for replacement, connect the repository with experimental and enter:
echo "Package: *
Pin: release o=experimental
Pin-Priority: 101" >> /etc/apt/preference
apt-build install upstart


Post on welinux.ru

Source: https://habr.com/ru/post/52368/


All Articles