Fedora 23 配置

时间:2023-03-08 15:43:26

Linux下安装Fedora

刻到u盘上

下好iso后准备刻录到u盘...可是查了一下只能在用一个叫dd的东西刻= =于是学了下...然而就是一句话:

dd if=/path/xxx.iso of=/dev/sdx

其中前面是文件,后面是盘,注意是整个盘sdx而不是什么sdx1啥的,注意这样做会格式化整个盘...请不要乱实验...。

(听说dd是自动识别然后自动刻录的真是厉害啊...

在bios设置u盘优先启动然后安装即可

/home

vi /etc/fstab

/dev/sda5 /home ext4 defaults 0 2

折腾

显卡驱动 & 不能关机、重启、注销、待机等解决方法

原因在于linux自带的nouveau驱动对N卡支持不是很好(至少对于我的765m是不好的..),所以禁止nouveau驱动和使用去掉nouveau模块的内核镜像后就能重起能关机啦!所以我们blacklist了nouveau。

sudo gedit /etc/modprobe.d/blacklist.conf

加上

blacklist nouveau
options nouveau modeset=0

然后重启。

https://fedoraproject.org/wiki/Bumblebee

可是这样就不能用独显了,所以我们还要装一个bumblebee来切换独显。(内核版本4.0.6-300.fc22.x86_64,bumblebee-nvidia版本:bumblebee-nvidia-352.21-1.fc22.x86_64测试成功)

sudo dnf -y --nogpgcheck install http://install.linux.ncsu.edu/pub/yum/itecs/public/bumblebee/fedora23/noarch/bumblebee-release-1.2-1.noarch.rpm
sudo dnf -y --nogpgcheck install http://install.linux.ncsu.edu/pub/yum/itecs/public/bumblebee-nonfree/fedora23/noarch/bumblebee-nonfree-release-1.2-1.noarch.rpm
sudo dnf install bumblebee-nvidia bbswitch-dkms primus kernel-devel

修改grub

缩短等待时间

编辑文件

sudo gedit /boot/grub2/grub.cfg

然后搜索timeout,后面数字修改为1

再继续编辑

sudo gedit /etc/default/grub

改成GRUB_TIMEOUT=1

调节亮度 & 关掉蓝牙

(可能要先安装rfkill才能关掉蓝牙

sudo gedit /etc/rc.local

然后在exit(0)前面加上

rfkill block bluetooth
echo 1580 > /sys/class/backlight/intel_backlight/brightness

dnf配置

sudo vim /etc/dnf/dnf.conf

加上fastestmirror=truekeepcache=true,分别表示选择最快镜像和保留缓存

更换源

cd /etc/yum.repos.d

然后选择其中一个国内源:

sudo wget http://mirrors.163.com/.help/fedora-163.repo
sudo wget http://mirrors.163.com/.help/fedora-updates-163.repo
sudo wget http://mirrors.sohu.com/help/fedora-sohu.repo
sudo wget http://mirrors.sohu.com/help/fedora-updates-sohu.repo
sudo wget http://mirror.bjtu.edu.cn/fedora-bjtu.repo
sudo wget http://mirror.bjtu.edu.cn/fedora-updates-bjtu.repo

加一个软件源,中文软件很实用的

sudo wget http://repo.fdzh.org/FZUG/FZUG.repo -P /etc/yum.repos.d/

加google-chrome的源:

sudo wget http://repo.fdzh.org/chrome/google-chrome-mirrors.repo -P /etc/yum.repos.d/

加rpmfusion的源:

sudo dnf install http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm
sudo dnf install http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm

使用socks5代理

sudo http_proxy=socks5h://127.0.0.1:10808 dnf

主题

numix主题和图标

sudo dnf copr enable satya164/numix
sudo dnf install numix-gtk-theme

然后是图标:

git clone https://github.com/numixproject/numix-icon-theme-circle

将两个文件夹复制到/usr/share/icons/目录下

打开tweak启用主题和图标即可

evopop主题

sudo dnf copr enable heikoada/gtk-themes
sudo dnf install evopop-gtk-theme-common.noarch evopop-gtk-theme-gtk3 evopop-gtk-theme-metacity evopop-gtk-theme-gtk2

arc主题

http://files.cnblogs.com/files/iwtwiioi/Arc-OSX-gnome3.18-1.5.tar.gz

软件

dnf install 清单

gnome-tweak-tool # tweak工具
kwplayer # 酷我
smplayer # 视频播放器
cherrytree # 必备树型笔记本
audacious # 音乐播放器
nautilus-open-terminal # 右键终端
vim # 没话说= =
texmaker # latex
texlive-* # latex
remarkable # markdown
gcc-c++ # = =
goldendict # 字典
unrar # rar
tsocks # socks5

fedy

http://folkswithhats.org/

迅雷(xware)

sudo dnf install xware-desktop

然后设置一下路径(不要登陆),详细看https://github.com/Xinkai/XwareDesktop/wiki/使用说明

然后我们可以用这个命令运行登陆下载拉~!

/usr/share/xware-desktop/xwared & xware-desktop

要是想方便的话做一个desktop咯

QQ7.5(最新版)

参考:http://kikyoulinux.info/wine-qq-6-7-and-7-x-refusing-to-annoying-fixme-output/

sudo dnf install wine
wget http://winetricks.org/winetricks
sudo mv winetricks /usr/bin/winetricks
sudo chmod +x /usr/bin/winetricks
winetricks riched20 gdiplus

至于某些地方中文显示为框框,把/usr/share/wine/fonts中的两个Tahoma字体删掉或者移动到别处,再在注册表中找到[HKEY_CURRENT_USER\Software\Wine\Fonts\Replacements],里面建立Tahoma的替换项目,比如新建字符串Tahoma,值为WenQuanYi Micro Hei,就是说用某字体替换Tahoma,如果Wine没有simsun字体,Replacements里面也没有,就用同样的方法创建SimSun的替换项目(最好从windows种copy一个SimSun字体过来,否则有各种字体问题)。

然后运行qq7.5的安装包(可以在 点击打开 这里下载),按步骤安装即可。

无法登录的话,打开wine taskmgr,把txplatform进程给kill掉就行了。要一劳永逸的话,在Winecfg的函数库中添加txplatform.exe,并设置为“停用”就行了。

然后就大功告成拉~

VirtualBox

cd /etc/yum.repos.d/
sudo wget http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo
sudo dnf update
sudo dnf install gcc kernel-devel
sudo dnf install VirtualBox-4.3
sudo service vboxdrv setup
sudo usermod -a -G vboxusers $USER

深度截图

https://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo/fedora-21-x86_64/

没办法fc22的版本没有= =因此强行安装了fc21的...没想到能用..

进入上面网址后依次下载并安装

deepin-gsettings, deepin-utils, deepin-ui, deepin-screenshot

wps

这个要去官网下载,而且下载完后将网络关掉,打开wps,将在线模板通通关掉。然后下载字体文件:http://files.cnblogs.com/files/iwtwiioi/symbol-fonts.zip,放到/usr/share/fonts中即可。

acejudge(laekov写的评测机orz)

https://github.com/laekov/acejudge

gnome插件

https://extensions.gnome.org/extension/945/cpu-power-manager/

https://extensions.gnome.org/extension/358/activities-configurator/

终端启动的用户 @ 主机名消失的解决方法

编辑~/.bashrc,加上:

if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

sudo补全问题

sudo dnf install bash-completion

一些字体问题

只要安装一些windows字体就行拉,某度字体就不会调用那啥arial字体了..

一个简单的办法就是:

wget http://www.my-guides.net/en/images/stories/fedora12/msttcore-fonts-2.0-3.noarch.rpm
sudo dnf install ./msttcore-fonts-2.0-3.noarch.rpm
mkfontscale
mkfontdir
fc-cache -fv

更改fonts.conf,默认的字体非常鬼畜,所以我们改一下,另存为.fonts.conf放到~目录下:

<!--?xml version="1.0"?>-->
<!--DOCTYPE fontconfig SYSTEM "fonts.dtd">-->
<!-- ~/.fonts.conf for per-user font configuration -->
<fontconfig>
<alias>
<family>serif</family>
<prefer>
<family>SimSun</family>
</prefer>
</alias>
<alias>
<family>sans-serif</family>
<prefer>
<family>SimHei</family>
</prefer>
</alias>
<alias>
<family>monospace</family>
<prefer>
<family>YaHei Consolas Hybrid</family>
</prefer>
</alias>
</fontconfig>

GoldenDict用mplayer播放卡顿问题

在设置里将Use external program设置为aplay即可。

chrome的一些卡顿问题(cpu100%)

一些书签、标签页、菜单卡顿问题原因在于字体,详见:http://suselinks.us/how-to-fix-slow-typing-in-chrome-addressbar-in-linux/]

解决方法就是换字体,经测试换成Source Han Sans CN Regular是可以解决的。

同时在chrome的启动器添加--enable-harfbuzz-rendertext参数即可解决。

gnome-terminal不能透明的问题

自己发现一个临时的办法:

.bashrc里加上

if [ -n "$WINDOWID" ]; then
TRANSPARENCY_HEX=$(printf 0x%x $((0xffffffff * 98 / 100)))
xprop -id "$WINDOWID" -f _NET_WM_WINDOW_OPACITY 32c -set _NET_WM_WINDOW_OPACITY "$TRANSPARENCY_HEX"
fi

gedit GBK 乱码

打开dconf-editor(如果没用,sudo dnf install dconf-tools),找到org/gnome/gedit/preferences/encodings,在auto-detected中加入GBK

unzip 解压乱码

似乎要重新编译?不过另有方法。我们写一个python脚本来实现解压就行了。

#!/usr/bin/python3

'''
Author:iwtwiioi
E-mail:iwtwiioi@gmail.com
version = 1.0
''' IZIP_VERSION = 'izip 1.0' import os, sys
import zipfile
import chardet
from optparse import OptionParser is_replace = False
file_encoding = ""
file_password = ""
extract_path = ""
is_quite = False class PasswordError(Exception):
pass def getBytesEncoding(s):
return chardet.detect(s)['encoding'] def bytes2str(s):
encoding = getBytesEncoding(s)
if file_encoding:
return s.decode(file_encoding)
return s.decode(encoding) def getZipfileBytes(s):
try:
by = s.encode('cp437')
except:
by = s.encode()
return by def P(s):
if is_quite:
return
print(s) def extract(file_name):
if not os.path.exists(file_name) or not zipfile.is_zipfile(file_name):
P('File "{0}" is not a zip file!'.format(sys.argv[i]))
return if os.path.exists(extract_path) and os.path.isfile(extract_path):
P('Error ** : path "{0}" is a file.'.format(extract_path))
return if not os.path.exists(extract_path):
os.makedirs(extract_path) try:
open_file = zipfile.ZipFile(file_name, 'r');
open_file.setpassword(file_password.encode())
except Exception:
P('File "{0}" can not open!'.format(file_name))
raise Exception P('Processing\t{0}'.format(file_name)) for name in open_file.namelist():
try:
utf8name = bytes2str(getZipfileBytes(name))
except Exception as e:
P(' Failed\tEncoding can not be identified.')
continue P(' Extracting\t' + utf8name)
pathname = os.path.dirname(utf8name)
if pathname != '' and not os.path.exists(extract_path + pathname):
os.makedirs(extract_path + pathname)
continue try:
data = open_file.read(name)
except Exception:
P('*** Wrong password ***')
raise PasswordError if not os.path.exists(extract_path + utf8name) or os.path.isfile(extract_path + utf8name) and is_replace:
try:
fo = open(extract_path + utf8name, 'wb')
fo.write(data)
fo.close()
except Exception:
P(' Failed\tCan not write file "{0}".'.format(extract_path + utf8name))
continue
P(' Skipped\t' + utf8name) open_file.close()
P('Done') def main(): global is_replace
global file_encoding
global file_password
global extract_path
global is_quite usage = 'usage: %prog [options] filename' parser = OptionParser(usage=usage, version=IZIP_VERSION)
parser.add_option('-r', '--replace', dest='is_replace',
action='store_true', default=False,
help='if file already exisited, replace it')
parser.add_option('-e', '--encoding', dest='encoding',
action='store', metavar='ENCODING',
help='specify the encoding of the file')
parser.add_option('-p', '--password', dest='password',
action='store', default='',
help='password of the file')
parser.add_option('-d', '--dir', dest='path',
action='store', default='.',
help='the path of extracting')
parser.add_option('-q', '--quite', dest='is_quite',
action='store_true', default=False,
help='process quitely') (options, args) = parser.parse_args() is_replace = options.is_replace
file_encoding = options.encoding
file_password = options.password
extract_path = options.path + '/'
is_quite = options.is_quite '''
P('is_replace\t: {0}'.format(is_replace))
P('file_encoding\t: {0}'.format(file_encoding))
P('file_password\t: {0}'.format(file_password))
P('extract_path\t: {0}'.format(extract_path))
''' for name in args:
try:
extract(name)
except PasswordError:
raise PasswordError
except Exception:
pass try:
main()
except PasswordError:
sys.exit(2)
except Exception:
sys.exit(1) sys.exit(0)

想用右键?新建一个文件放到~/.local/share/nautilus/scripts/文件夹里,内容如下

#!/bin/bash
(
for File in "$@"; do
if [ -d "$File" ]; then
zenity --error --title="Error" --text="'$File' is not a file."
continue
else
echo "# Extracting '$File'"
izip -r -e gbk -q $File
rt=$?
if [ $rt -eq 1 ]; then
zenity --error --title="Error" --text="'$File' failed to extract."
continue
elif [ $rt -eq 2 ]; then
while true; do
psw=$(zenity --entry --title="Enter password for '$File'" --text "" --hide-text)
if [ $? -ne 0 ]; then
break
fi
izip -r -e gbk -q -p $psw $File
zipret=$?
if [ $zipret -eq 0 ]; then
echo "# Right password! "
break
elif [ $zipret -eq 1 ]; then
zenity --error --title="Error" --text="'$File' failed to extract."
break
elif [ $zipret -eq 2 ]; then
echo "# Wrong password! "
fi
done
fi
fi
done
)|
zenity \
--progress \
--title="Extract files in GBK" \
--text="Extracting..." \
--percentage=0 \
--auto-close \
--pulsate
if [ "$?" = -1 ]; then
zenity --error \
--text="Failed."
fi

vim 配置

安装Vundle

配置文件

" autocomplete
set nocompatible
filetype off set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin() Plugin 'VundleVim/Vundle.vim' Bundle 'Valloric/YouCompleteMe' call vundle#end()
filetype plugin indent on let g:ycm_error_symbol = 'ER'
let g:ycm_warning_symbol = 'WA'
let g:ycm_global_ycm_extra_conf='~/.vim/bundle/YouCompleteMe/cpp/ycm/.ycm_extra_conf.py' autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
autocmd InsertLeave * if pumvisible() == 0|pclose|endif nmap <C-F11> :YcmDiags<CR> " competition
set nu ru mouse=a sw=4 ts=4 sts=4 nobk autoindent incsearch hlsearch t_Co=256
set cindent
syntax on
" colorscheme koehler
colorscheme molokai " 考场就用 koehler map <F2> : w <CR>
map <F3> : !./%< <CR>
map <F4> : !./%< < ./in > ./out <CR>
map <F5> : !g++ % -o %< -Wall -lm <CR>
map <C-F5> : !g++ % -o %< -O2 -Wall -lm <CR>
map <F6> : !g++ % -o %< -g -Wall -lm <CR>
map <C-F6> : !python3 % <CR>
map <F7> : !gdb %< <CR>
map <C-F9> : vs ./in <CR>
map <C-F10> : vs ./out <CR>
map <C-F7> : !astyle --style=java -p -H < % > hh.cpp <CR> " Fold
function! CFoldText()
let sub = substitute(getline(v:foldstart), '\s*\(.*\){.*', '\1', 'g')
return sub . ' (' . (v:foldend - v:foldstart + 1) . ' lines)'
endfunction set foldmethod=syntax
set foldtext=CFoldText()
set fillchars-=fold:-
set foldlevel=99
nnoremap <space> @=((foldclosed(line('.')) < 0) ? 'zC' : 'zO') <CR>

然后看这里配置高亮.

如果上面运行出错(反正我是崩了),用这个方法:

重启X

alt+F2,输入r重启桌面环境