歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Debian系統初裝後的各種配置

Debian系統初裝後的各種配置

日期:2017/2/28 14:35:15   编辑:Linux教程

最近經常重裝系統,而剛裝完Debian系統的電腦需要各種配置真心有點煩躁,於是乎想寫個腳本偷偷懶,解決一下每次裝系統都要重新配置的問題(在這分享給大家,也簡化了大家裝Debian後麻煩的配置過程)。

一、使用方法

1. 下載我打包的文件new_machine.tar ,然後在我的雲盤分享處下載Linux的wps安裝包(我自己會在Debian系統中使用WPS,這樣可以輕松在Linux中對文檔進行修改,如果直接Libreoffice對Windows下的文檔進行修改,以後再拿到Windows下打開時排版都會全亂了)

相關下載地址:

百度網盤免費下載地址:http://pan.baidu.com/s/1nt3A2MX

2. cd ~/Download ---> tar -xvf new_machine.tar 進入下載目錄解壓new_machine.tar文件

3.cd new_machine

4.mv ~/Download/wps-office_8.1.0.3724~b1p2_i386.deb .

5.ifconfig 或者ping www.linuxidc.com確認電腦是否聯網

6.su 切換至 root 用戶

7.chmod +x install.sh ---> ./install.sh 好了,腳本會安裝很多東西,所以此時你可以去吃飯或者打球去了!

二、腳本展示

初學者寫的比較簡單,有好的建議還望大家提出來:

#!/bin/bash
# (C) 2014 Yunlong Zhou <[email protected]>
# 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 connecting 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 cscope 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*

文中涉及很多Debian配置方面的東西,如果大家有興趣歡迎出門右拐看一下我之前的博文:

《Debian安裝全攻略》 http://www.linuxidc.com/Linux/2014-03/97965.htm

《Ubuntu 下安裝WPS for Linux》 http://www.linuxidc.com/Linux/2013-06/85374.htm

《Ubuntu下創建Vim+Taglist+Cscope+Ctags組合編輯器》 http://www.linuxidc.com/Linux/2012-10/72062.htm

推薦閱讀:

Debian 7.0 Wheezy 測試體驗 http://www.linuxidc.com/Linux/2013-05/84646.htm

Debian 7.0 Wheezy 發布! http://www.linuxidc.com/Linux/2013-05/83883.htm

U盤安裝Debian 7.0 Wheezy http://www.linuxidc.com/Linux/2013-05/84647.htm

Copyright © Linux教程網 All Rights Reserved