Linux系统最佳实践经验

用户管理php

一、groups 查看当前用户所在的组;
将 newuser添加到组staff中
# usermod -G staff newuser
# usermod -aG dlong dlong 将用户dlong加入到dlong组,不退出原组。-d参数为删除该组用户。
二、修改newuser的用户名为newuser1
# usermod -l newuser1 newuser
三、锁定帐号 newuser1
# usermod -L newuser1
四、解除对 newuser1 的锁定
# usermod -U newuser1css


ManjaroLinux 系统设置html

源的配置:
sudo pacman-mirrors -c China
sudo pacman-mirrors -i -c China -m rank
以上命令实际是修改并编辑 /etc/pacman-mirrors.conf。
添加中科大源:
sudo gedit /etc/pacman.conf,在文件末尾添加:
[archlinuxcn]
SigLevel = Optional TrustedOnly
Server = https://mirrors.ustc.edu.cn/archlinuxcn/$arch
以上命令后能找到源里的软件,但没有密约不能安装,执行:
sudo pacman -Syy && sudo pacman -S archlinuxcn-keyring。
输入的安装和配置:
通常是要sudo gedit ~/.xprofile而后在里面添加:
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS=”@im=fcitx”linux

更新系统错误nginx

命令行sudo apt-get update 或者运行更新管理器的时候。
出现W: GPG 错误:http://ppa.launchpad.net lucid Release: 因为没有公钥,没法验证下列签名: NO_PUBKEY FAF69C646FF368B7的问题。
能够在终端中运行:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys FAF69C646FF368B7
总的来讲同:sudo apt-key adv --keyserver 服务器 --recv-keys 密约关键是密约,好像很难找到,不晓得官网有没有?
另外能够这样增长密约:方法是使用管道,原理同样。但仍是要密约!
gpg --keyserver subkeys.pgp.net --recv-keys 40976EAF437D05B5
gpg -a --export 40976EAF437D05B5 | sudo apt-key add -
/etc/apt/sources.list这是源列表,可增长或删除源。不能更新源时,删除/var/lib/apt里的文件,就能够解决问题。
/usr/share/keyrings为软件源的密约,在更新更新系统软件时有时要密约,能够将不用的删除。
sudo apt-get install ubuntukylin-keyring能够用来安装密约文件。web

每次开机都出现错误提示解决办法shell

开出出现错误如:System program problem detected 很麻烦,关闭方法:sudo gedit /etc/default/apport
enabled=0
把原先的1改为0就能够了。数据库

显示错误apache

因为显示错误,退出图形界面,没法登录,没法运行程序,这是由于显示管理器出现故障,能够运行:sudo dpkg-reconfigure lightdm/gdm来解决。ubuntu

修复引导记录

sudo mount /dev/sda1 /mnt/sda
sudo grub-install --root-directory=/mnt/sda/ /dev/sda
(本步骤用于来从新安装grub2到硬盘的主引导记录【MBR】里面,十分关键!),最后:sudo update-grub2

软件包安装,删除出错的终极解决方法

本方法适用于任何软件包安装,删除时报告的相似于:“post-xxxxx失败”,以及其余错误。
主要是删除下面这个文件中阻碍安装删除的文字.
原理:dpkg之因此可以对每一个包的状态了如指掌,彻底是由于dpkg数据库--→>/var/lib/dpkg/status

安装并更新系统软件或是其它的软件

安装软件:apt-get install 软件名
删除软件:apt-get remove 软件名
自动删除软件:apt-get autoremove 软件名 //有可能将有用的软件删去
更新软件先更新源:apt-get update //更新软件数据 upgrade //更新升级系统。
purge - Remove packages and config files
dist-upgrade - Distribution upgrade, see apt-get(8)
dselect-upgrade - Follow dselect selections
clean - Erase downloaded archive files

修改键盘映射

命令行输入:xev
获得要修改的键的代码
xmodmap -pke > ~/.Xmodmap
kwrite ~/.Xmodmap
xmodmap ~/.Xmodmap

Fedora 19安装中文

yum list kde*chinese;便显示了下列两个文件:kde-i18n-Chinese.noarch kde-l10n-Chinese.noarch。

若是没有五笔输入法

sudo apt-get install ibus
sudo apt-get install ibus-sunpinyin
sudo apt-get install ibus-pinyin
sudo apt-get install ibus-table-wubi
sudo apt-get install gnome-icon-theme
ibus-setup
ibus-daemon -drx

安装打印机服务

一、先使用systemctl list-unit-files查看服务运动状态,systemctl enable procps.service。
二、apt-get install cups。
三、apt-get install cups-client cups-core-drivers(这个能够不安装)。

安装gnome环境

Sudo apt-get install gnome-shell,就能够安装gnome桌面环境,界面较简洁。
修改/usr/share/gnome-shell/theme/gnome-shell.css,要解决花屏,去掉全部transition-duration相关的代码。
查看:icon-grid与panel能够修改DASH程序视图。


让不一样的程序在不一样的桌面显示

修改/usr/share/applications下的desktop文件内容:
• NoDisplay=true
• OnlyShowIn=KDE;
• NotShowIn=KDE;

更改命令名称

alias iis='service nginx start'
alias iid='service nginx stop'

Fedora安装视频音频解码器

$> su -
#> dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
#> dnf install https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
#> dnf install vlc
安装解码器命令:su -c 'yum localinstall --nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm'
sudo yum localinstall --nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-branched.noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-branched.noarch.rpmᄃ
su -c 'rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm'ᄃ
rpm -ivh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-20.noarch.rpm
rpm -ivh http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-20.noarch.rpm
dnf install http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-20.noarch.rpm
sudo apt-get install ubuntu-restricted-extras

实战解决rhythmbox 乱码

对于全部用gstreamer作后端的播放器,如Rhythmbox,设置以下的环境变量后便可正确读取mp3中GBK编码的id3 tag。
sudo gedit /etc/profile
在最后加入
export GST_ID3_TAG_ENCODING=GBK:UTF-8:GB18030
export GST_ID3V2_TAG_ENCODING=GBK:UTF-8:GB18030
注销后从新导入歌曲信息便可解决乱码。
我弄的,更绝:
export GST_ID3_TAG_ENCODING=ASCII:GB2312:GBK:GB18030:UTF-8:UTF16:UTF32
export GST_ID3V2_TAG_ENCODING=ASCII:GB2312:GBK:GB18030:UTF-8:UTF16:UTF32
保存,退出;

Fedora启动优化

查看启动服务:chkconfig
查看开机服务:systemctl list-unit-files
systemctl list-unit-files --type=service | grep enable/disabled/maked(查看启动/禁用/标记的服务状况)。
查看开机各程序所用时间:systemd-analyze plot > plot.svg
禁用服务:sudo systemctl disable 服务名称。

取消客户登录

#sudo gedit /etc/lightdm/lightdm.conf,添加 allow-guest=false , 即以下内容:
[SeatDefaults]
greeter-session=unity-greeter
user-session=ubuntu
allow-guest=false

桌面没有快捷方式

1.安装gnome-tweak-tool
# yum install gnome-tweak-tool亲手试过了,这个是不行的,版本落后了,在加删除程序中安装程序。
2.在应用程序里找到这个软件,经过配置桌面,能够把个人电脑回收站等放在桌面上
3.进入文件系统 usr/share/application,能够在须要桌面显示的程序上右键 复制到桌面,OK了。

创建关机快捷方式

#!/bin/bash
sudo -S shutdown -h now <<EOF
password
EOF
或:
echo password | sudo -S shutdown -r now 其中的-S是必须的,代替终端输入。
再为启动程序建立一个快捷方式,或是将用户文件夹下的.CONFIG文件下autorun文件夹下的程序复制进行修改。
将上面的文字保存在/sbin文件夹下,并设置为可启动程序。

删除旧内核

sudo dpkg --get-selections|grep linux
sudo apt-get remove linux-image-2.6.27-7-generic
dpkg --list|grep linux-image
sudo apt-get purge linux-image-4.14.12-041412-generic

清除残余的配置文件

dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P

使用命令不记得命令

look 要查询的单词

yes 要输出的文字,这些文字用引号引发来

ping -c -i i指一次用的时间,c总次数。

安装MediterraneanNight系列主题

sudo add-apt-repository ppa:webupd8team/themes
sudo apt-get update
sudo apt-get install mediterraneannight-gtk-theme

linux下安装火狐中国版总结

1. 下载的bz2格式的火狐。2. 解压。3. 将解压获得的整个文件夹CP到系统的lib文件夹下。4. 建立连接:sudo ln -s /usr/lib/firefox/firefox /usr/bin/firefox

 

 

安装永中办公软件

1. 先解压
2. 命令转到目录:./setup
3. OK

安装DOCK

sudo apt-add-repository ppa:ricotz/docky
sudo apt-get update
sudo apt-get install plank
Plank 可谓简洁到家,没有任何图形化配置,若是你想要配置,只能修改其配置文件:sudo gedit ~/.config/plank/dock1/settings

>>用Linux做WEB服务器
用Linux做WEB服务器

采用nginx创建我的网站只有三步:
一、卸载apache,安装nginx并启动服务:

sudo apt-get purge apache2* 删除apache2有关的程序,*表明任意。
sudo apt-get autoremove 自动删除无用的临时文件。
sudo apt-get install nginx 安装服务软件。
sudo service nginx start 启动服务。
检查:浏览器地址栏输入: http://localhost。
二、修改配置:
sudo gedit /etc/nginx/nginx.conf
把worker_processes设置成你的CPU数目,如1,2,4等;
sudo gedit /etc/nginx/sites-available/default,修改:
server {
listen 80 default_server;
root /usr/share/nginx/html; #修改成你的网站目录,如: /webServer/main
index index.php index.html index.htm;
}
三、 重启服务:sudo service nginx restart

用Linux做FTP服务器

安装FTP服务软件:yum install vsftpd
启动服务程序:service vsftpd start
Vsftpd配置方法:
# Use this to jail all users in their homes
DefaultRoot ~
# Users require a valid shell listed in /etc/shells to login.
# Use this directive to release that constrain.
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> me start
RequireValidShell off
AuthOrder mod_auth_file.c
AuthUserFile /etc/proftpd/ftpd.passwd
AllowRetrieveRestart on
AllowStoreRestart on
ServerIdent off
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> me end
创建用户
root@debian:/home/mmc# ftpasswd --file=/etc/proftpd/ftpd.passwd --home=/home/dlong --shell=/bin/false --name=dlongx --uid=33 --gid=34 --passwd
修改文件夹的权限:
调用文件夹用户为:www-data

DEEPIN显示优化

sudo deepin-feedback-cli#开启 metacity 窗管合成:deepin-metacity --composite --replace#关闭 metacity 窗管合成,取代正在运行的窗管:deepin-metacity --no-composite --replace#deepin-wm窗管,取代正在运行的窗管:deepin-wm --replacedeepin-metacity --replacedeepin-metacity --helpstartx

相关文章
相关标签/搜索