Recently, the system is often reinstalled, and the computer that just installed the Debian system needs a variety of configurations, so I want to write a script to be secretly lazy, solve the problem that the system needs to be reconfigured every time it is installed (this article also simplifies the complicated configuration process after Debian is installed ).
I. Usage
1. download the package new_machine.tar, and then download the Linux wps installation package in my cloud disk sharing area (I will use WPS in the Debian system, so that you can easily modify the file in Linux, if Libreoffice is used to modify files in Windows, the layout will be messy when the files are opened in Windows)
Related:
Baidu Network Disk Free: http://pan.baidu.com/s/1nt3A2MX
2. cd ~ /Download ---> tar-xvf new_machine.tar
3. cd new_machine
4. mv ~ /Download/wps-office_8.1.0.3724 ~ B1p2_i386.deb.
5. ifconfig or ping www.bkjia.com to check whether the computer is connected to IOT platform.
6. Switch su to the root user
7. chmod + x install. sh --->./install. sh is ready. The script will install many things, so now you can go to dinner or play!
Ii. Script display
It is relatively simple for beginners to write, and I hope you can come up with some suggestions:
#! /Bin/bash
# (C) 2014 Yunlong Zhou <reaper888@yeah.net>
# Under licence GPL
# File: install. sh
# Introduction:
# This script is using for simplify the installing of Debian 5/6/7 new install machine
# Useage:
#1. "su" -- get root permission
#2. "ifconfig" or "ping www.baidu.com" -- to check if the computer is ing Internet
#3. if have no Internet, "dhclient eth0" -- to connect the Internet
#4. "tar-xvf new_machine.tar" then "cd new_machine"
#5. "chmox + x install. sh" -- give our script a execution permission
#5. "./install. sh" -- auto install and you can have a coffee now
# Firstly, we set the apt-source, here we just give Debian 5/6/7 set module, if you use older or newer Debian version, Just do a little change!
Echo "Now setting apt source"
If grep-q "7. *"/etc/debian_version | grep-q-I "wheezy"/etc/debian_version; [[$? = 0]; then
Echo "deb http://mirrors.163.com/debian wheezy main contrib non-free">/etc/apt/sources. list
Elif grep-q "6. *"/etc/debian_version | grep-q-I "squeeze"/etc/debian_version; [$? = 0]; then
Echo "deb http://mirrors.163.com/debian squeeze main contrib non-free">/etc/apt/sources. list
Elif grep-q "5. *"/etc/debian_version | grep-q-I "lenny"/etc/debian_version; [[$? = 0]; then
Echo "deb http://mirrors.163.com/debian lenny main contrib non-free">/etc/apt/sources. list
Fi
Apt-get update
# Add chinese fonts and ibus, if you don't need, just comment it
Echo "Now doning Chinese install"
Echo Y | apt-get install ttf-wqy-zenhei xfonts-intl-chinese wqy * ibus im-switch ibus-pinyin
# Add some useful application, if you need some changes, just do it
Echo "Now doing some application install"
Echo Y | apt-get install aptitude dia xournal wireshark ssh unzip ctags cs.pdf git chromium-browser vim screen linuxlogo libncurses5-dev build-essential libc6-dbg kernel-package
# Install sudo, if you don't need just comment it
Echo "Now install sudo for your system and give your user a sudoer permission"
Echo Y | apt-get install sudo
My_user = 'who | head-n 1 | cut-d ""-f 1'
Echo "$ my_user ALL = (ALL: ALL) ALL">/etc/sudoers
# The function is using for check if a application is installed, if not installed just install it with apt-get install
Function install_app # para is the func you want to install
{
Aptitude search $1>/tmp/log
File_line = 'cat/tmp/log | wc-l'
For (I = 1; I <= $ file_line; I ++); do
Sed-n "$ I" 'P'/tmp/log>/tmp/log1
I _status = 'awk' {print $1} '/tmp/log1'
Par2 = 'awk' {print $2} '/tmp/log1'
Par3 = 'awk' {print $3} '/tmp/log1'
If [[$ par2 = $1 | $ par3 = $1 & $ I _status! = 'I']; then
Echo "Sorry, \" $1 \ "not installed, we will install it"
Apt-get install $1
Elif [[$ par2 = $1 | $ par3 = $1 & $ I _status = 'I']; then
Echo "OK, \" $1 \ "has been installed"
Break
Fi
Done
Rm/tmp/log/tmp/log1
}
# Sometimes, our system have no graphic interfaces, we use these to install GNOME, if no need comment it
Echo "Now installing gnome"
Install_app xorg
Install_app gnome-core
Install_app gdm3
# Add flash support for FireFox and Chrome Browse
Echo "Now add flash support for browse"
Mkdir-p/home/$ my_user/. mozilla/plugins/
Mv libflashplayer. so/home/$ my_user/. mozilla/plugins/
# Add vim config
Echo "Now add vim config"
Mkdir-p/home/$ my_user/. vim/plugin
Mv taglist. vim/home/$ my_user/. vim/plugin/
Mv vimrc/etc/vim/vimrc
# Install WPS for i386/i686 system
Echo "Now installing WPS"
Uname-a>/tmp/system_version
If grep "i386"/tmp/system_version | grep "i686"/tmp/system_version; then
Dpkg-I symbol-fonts _*
If [! -F wps-office _ *]; then
Echo "Now doloading wps for linux, may need a little long time"
Wget http://wdl1.cache.wps.cn/wps/download/Linux/unstable/wps-office_8.1.0.3724 ~ B1p2_i386.deb
Fi
Dpkg-I wps-office _*
Else
Echo "Sorry, your system is not 32 bit system, we will not install wps"
Fi
# Install deepin screenshot
Echo "Now installing deepin screen shot"
Echo Y | apt-get install python-xlib
Dpkg-I deepin-scrot *
Note:
This article involves a lot of Debian configuration items. If you are interested, please turn right to see my previous blog post:
Debian Installation Guide
Install WPS for Linux in Ubuntu
Create a Vim + Taglist + cssag + Ctags editor in Ubuntu
Recommended reading:
Debian 7.0 Wheezy test experience
Debian 7.0 Wheezy released!
Install Debian 7.0 Wheezy on a USB flash drive